|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.stanbol.entityhub.servicesapi.util.ModelUtils
public final class ModelUtils
Utilities useful for implementations of the Entityhub Model
| Field Summary | |
|---|---|
static Comparator<Representation> |
RESULT_SCORE_COMPARATOR
Comparator based on the RdfResourceEnum.resultScore property that
assumes that values of this property implement Comparable. |
| Method Summary | ||
|---|---|---|
static
|
addToCollection(Iterator<? extends T> it,
Collection<T> c)
Adds the elements of the Iterator to the parsed Collection |
|
static
|
addToSet(Iterator<? extends T> it,
Set<T> set)
Adds the elements of the Iterator to the parsed Set |
|
static
|
asCollection(Iterator<? extends T> it)
Copies all elements of the parsed Iterator to a ArrayList. |
|
static
|
asSet(Iterator<? extends T> it)
Copies all elements of the parsed Iterator to a HashSet. |
|
static void |
checkValues(ValueFactory valueFactory,
Object value,
Collection<Object> results)
Processes a value parsed as object to the representation. |
|
static String |
getAboutRepresentation(Representation metadata)
Getter for the id of the Entity the parsed metadata
are about. |
|
static String[] |
getNamespaceLocalName(String uri)
Splits up a URI in local name and namespace based on the following rules If URI starts with "urn:" and last index of ':' == 3 than the there is no namespace and the whole URI is a local name if the uri starts with "urn:" and the last index of ':' ia > 3, than the last index ':' is used. |
|
static QName |
getQName(String uri)
This Method uses getNamespaceLocalName(String) to split up
namespace and local name. |
|
static String |
getRepresentationInfo(Representation rep)
String representation of the parsed Representation inteded for DEBUG level loggings. |
|
static UUID |
randomUUID()
TODO: Maybe we need a better way to generate unique IDs |
|
static void |
setSeed(long seed)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Comparator<Representation> RESULT_SCORE_COMPARATOR
RdfResourceEnum.resultScore property that
assumes that values of this property implement Comparable. The
Representation with the highest score will be first
| Method Detail |
|---|
public static UUID randomUUID()
public static void setSeed(long seed)
public static void checkValues(ValueFactory valueFactory,
Object value,
Collection<Object> results)
null values
Reference
Text (the second entry is used as language.
Further entries are ignored.
Iterable (any Array or
Collection), Iterator or Enumeration is parsed.
IllegalArgumentException
in case any of the parsed values is invalid. Currently invalid values are
just ignored.
value - the value to parseresults - the collections the results of the parsing are added to.public static String getRepresentationInfo(Representation rep)
rep - the representation
public static <T> Collection<T> asCollection(Iterator<? extends T> it)
ArrayList.
To use other Set implementations that ArrayList you can use
{@link #addToCollection(Iterator, Collection)
T - the generic type of the returned Collectionit - the Iterator with elements compatible to T
IllegalArgumentException - if the parsed Iterator is null
public static <T> Collection<T> addToCollection(Iterator<? extends T> it,
Collection<T> c)
Iterator to the parsed Collection
T - the type of the collectionit - the iterator over elements that are compatible to Tc - the collection to add the elements
IllegalArgumentException - if the parsed Collection is null.public static <T> Set<T> asSet(Iterator<? extends T> it)
HashSet.
To use other Set implementations that HashSet you can use
addToSet(Iterator, Set)
T - the generic type of the returned setit - the Iterator with elements compatible to T
IllegalArgumentException - if the parsed Iterator is null
public static <T> Set<T> addToSet(Iterator<? extends T> it,
Set<T> set)
Iterator to the parsed Set
T - the type of the setit - the iterator over elements that are compatible to Tset - the set to add the elements
Set with the added Elements
IllegalArgumentException - if the parsed Set is null.public static String[] getNamespaceLocalName(String uri)
uri - The uri
null. In the second the local name is stored.public static QName getQName(String uri)
getNamespaceLocalName(String) to split up
namespace and local name. It uses also the Data in the
NamespaceEnum to retrieve prefixes for Namespaces.
uri - the URI
public static String getAboutRepresentation(Representation metadata)
throws IllegalStateException
metadata
are about.
metadata - the metadata
null if the parsed Representation
is null or does not define a value for
RdfResourceEnum.aboutRepresentation
IllegalStateException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||