|
||||||||||
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,IPredicateValuePairs>
org.weblab_project.core.helper.impl.Statements
public class Statements
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 | |
---|---|
protected java.util.Map<java.lang.String,org.weblab_project.core.model.Resource> |
annotatedOn
|
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" |
protected java.util.List<java.lang.String> |
namespaces
|
protected java.util.Map<java.lang.String,org.weblab_project.core.model.Resource> |
resourcesMap
|
Constructor Summary | |
---|---|
Statements(java.lang.String... namespaces)
|
Method Summary | ||
---|---|---|
protected void |
add(WTriple wt)
|
|
void |
addAll(java.util.List<WTriple> wtl)
Add a list of WTriple in ths Statements |
|
org.weblab_project.core.model.Resource |
getAnnotatedResourceWith(java.lang.String uri)
Returns a resource on which a statement with this uri has been found |
|
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. |
|
java.util.LinkedHashMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>> |
getMap()
Deprecated. Please avoid to use this thing |
|
org.weblab_project.core.model.Resource |
getResource(java.lang.String uri)
Return the WebLab Resource associated with the given URI. |
|
java.util.Set<java.lang.String> |
getSubjects(java.lang.String predicate,
java.lang.String object)
Returns all the subjects that matches the tuple (predicate,object) |
|
|
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)
Returns 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)
Returns a list of URI in the order of predicates sorted by a comparator. |
|
java.lang.String |
toString()
|
|
void |
writeAndAdd(Statements map,
org.weblab_project.core.model.PieceOfKnowledge pok,
java.lang.String... uris)
Write all statements from a Statements on the given Pok and add these statements on this Statements. |
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
protected java.util.Map<java.lang.String,org.weblab_project.core.model.Resource> resourcesMap
protected java.util.Map<java.lang.String,org.weblab_project.core.model.Resource> annotatedOn
protected java.util.List<java.lang.String> namespaces
Constructor Detail |
---|
public Statements(java.lang.String... namespaces)
Method Detail |
---|
public void addAll(java.util.List<WTriple> wtl)
wtl
- a list of Wtriplepublic 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)
uri
-
protected void add(WTriple wt)
public java.lang.String toString()
toString
in class java.util.AbstractMap<java.lang.String,IPredicateValuePairs>
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 java.util.LinkedHashMap<java.lang.String,java.util.LinkedHashMap<java.lang.String,java.lang.Object>> getMap()
public <T> T getTypedValue(java.lang.String subject, java.lang.String property, java.lang.Class<T> clazz)
T
- the type to be returnedsubject
- a subjectproperty
- a propertyclazz
- a class of the type of the value
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
public java.util.Set<java.lang.String> getSubjects(java.lang.String predicate, java.lang.String object)
predicate
- object
-
public void writeAndAdd(Statements map, org.weblab_project.core.model.PieceOfKnowledge pok, java.lang.String... uris) throws org.weblab_project.core.exception.WebLabCheckedException
an
- other Statementspok
- a PieceOfKnoelegde on which statements will be writtenuris
- a mapping of uris. Uris are mapped using couples (previous_uri,future_uri)
org.weblab_project.core.exception.WebLabCheckedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |