|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>>
org.weblab_project.core.helper.impl.WTripleMap
public class WTripleMap
An efficient structure to gather and access triples and their subject/predicates/values This structure supports a list of values if multiple values are found for a given subject and predicate.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.util.AbstractMap |
---|
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Field Summary | |
---|---|
static java.util.Comparator<java.lang.String> |
ASC
An ascending comparator the value "a" will be after the value "b" |
static java.util.Comparator<java.lang.String> |
DESC
A descending comparator the value "a" will be before the value "b" |
Constructor Summary | |
---|---|
WTripleMap()
|
Method Summary | ||
---|---|---|
protected void |
add(WTriple wt)
|
|
void |
addAll(java.util.List<WTriple> wtl)
|
|
org.weblab_project.core.model.Resource |
getAnnotatedResourceWith(java.lang.String uri)
|
|
java.lang.String |
getFirstValue(java.lang.String subject,
java.lang.String predicate,
java.util.Locale locale)
Returns the first value corresponding to the predicate given. |
|
org.weblab_project.core.model.Resource |
getResource(java.lang.String uri)
Return the WebLab Resource associated with the given URI. |
|
|
getTypedValue(java.lang.String subject,
java.lang.String property,
java.lang.Class<T> clazz)
Return a typed value rather than an object. |
|
|
getTypedValues(java.lang.String subject,
java.lang.String property,
java.lang.Class<T> clazz)
Returns a list of typed values. |
|
java.util.LinkedList<java.lang.String> |
sortBy(java.lang.String predicate,
java.util.Comparator<java.lang.String> comparable)
Return a list of URI in the order of predicates sorted by a comparator. |
|
java.util.LinkedList<java.lang.String> |
sortBy(java.lang.String predicate,
java.util.Comparator<java.lang.String> comparable,
boolean defined)
Return a list of URI in the order of predicates sorted by a comparator. |
|
java.lang.String |
toString()
|
Methods inherited from class java.util.LinkedHashMap |
---|
clear, containsValue, get, removeEldestEntry |
Methods inherited from class java.util.HashMap |
---|
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
---|
equals, hashCode |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Field Detail |
---|
public static final java.util.Comparator<java.lang.String> ASC
public static final java.util.Comparator<java.lang.String> DESC
Constructor Detail |
---|
public WTripleMap()
Method Detail |
---|
public void addAll(java.util.List<WTriple> wtl)
public org.weblab_project.core.model.Resource getResource(java.lang.String uri)
uri
- an URI
public org.weblab_project.core.model.Resource getAnnotatedResourceWith(java.lang.String uri)
protected void add(WTriple wt)
public java.lang.String toString()
toString
in class java.util.AbstractMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>>
public java.util.LinkedList<java.lang.String> sortBy(java.lang.String predicate, java.util.Comparator<java.lang.String> comparable, boolean defined)
defined
is false, else it will not be added in the final list.
predicate
- the predicate on which value will be sortedcomparable
- the sorterdefined
- if false uri without predicate defined will be added at the end of the list, else it will be ignored
public java.util.LinkedList<java.lang.String> sortBy(java.lang.String predicate, java.util.Comparator<java.lang.String> comparable)
predicate
- the predicate on which value will be sortedcomparable
- the sorter
public java.lang.String getFirstValue(java.lang.String subject, java.lang.String predicate, java.util.Locale locale)
subject
- optional, use null as wildcardpredicate
- the uri of predicatelocale
- the locale, optional set to null as wildcard
public <T> T getTypedValue(java.lang.String subject, java.lang.String property, java.lang.Class<T> clazz)
T
- subject
- property
- clazz
-
public <T> java.util.LinkedList<T> getTypedValues(java.lang.String subject, java.lang.String property, java.lang.Class<T> clazz)
T
- the type of the valuesubject
- the uri of the subjectproperty
- the uri of the subjectclazz
- the class of the value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |