net.fortytwo.sesametools
Class ValueComparator
java.lang.Object
net.fortytwo.sesametools.ValueComparator
- All Implemented Interfaces:
- Comparator<org.openrdf.model.Value>
public class ValueComparator
- extends Object
- implements Comparator<org.openrdf.model.Value>
Implements a Comparator for OpenRDF Value objects where:
the order for Values is:
* Blank Node's
* URI's
* Literals
with null Values sorted before others
- Author:
- Peter Ansell p_ansell@yahoo.com
|
Method Summary |
int |
compare(org.openrdf.model.Value first,
org.openrdf.model.Value second)
Sorts in the order nulls>BNodes>URIs>Literals
This is due to the fact that nulls are only applicable to contexts,
and according to the OpenRDF documentation, the type of the null
cannot be sufficiently distinguished from any other Value to make
an intelligent comparison to other Values
http://www.openrdf.org/doc/sesame2/api/org/openrdf/OpenRDFUtil.html#verifyContextNotNull(org.openrdf.model.Resource...)
BNodes are sorted according to the lexical compare of their identifiers,
which provides a way to sort statements with the same BNodes in the same positions, near each other
BNode sorting is not specified across sessions |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BEFORE
public static final int BEFORE
- See Also:
- Constant Field Values
EQUALS
public static final int EQUALS
- See Also:
- Constant Field Values
AFTER
public static final int AFTER
- See Also:
- Constant Field Values
ValueComparator
public ValueComparator()
compare
public int compare(org.openrdf.model.Value first,
org.openrdf.model.Value second)
- Sorts in the order nulls>BNodes>URIs>Literals
This is due to the fact that nulls are only applicable to contexts,
and according to the OpenRDF documentation, the type of the null
cannot be sufficiently distinguished from any other Value to make
an intelligent comparison to other Values
http://www.openrdf.org/doc/sesame2/api/org/openrdf/OpenRDFUtil.html#verifyContextNotNull(org.openrdf.model.Resource...)
BNodes are sorted according to the lexical compare of their identifiers,
which provides a way to sort statements with the same BNodes in the same positions, near each other
BNode sorting is not specified across sessions
- Specified by:
compare in interface Comparator<org.openrdf.model.Value>
Copyright © 2013. All Rights Reserved.