|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractSet<Statement>
org.openrdf.model.impl.LinkedHashModel
public class LinkedHashModel
Model implementation using LinkedHashSet.
| Constructor Summary | |
|---|---|
LinkedHashModel()
|
|
LinkedHashModel(Collection<? extends Statement> c)
|
|
LinkedHashModel(int size)
|
|
LinkedHashModel(Map<String,String> namespaces)
|
|
LinkedHashModel(Map<String,String> namespaces,
Collection<? extends Statement> c)
|
|
LinkedHashModel(Map<String,String> namespaces,
int size)
|
|
| Method Summary | |
|---|---|
boolean |
add(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Adds one or more statements to the model. |
boolean |
add(Statement st)
|
void |
clear()
|
boolean |
clear(Resource... contexts)
Removes statements with the specified context exist in this model. |
boolean |
contains(Object o)
|
boolean |
contains(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Determines if statements with the specified subject, predicate, object and (optionally) context exist in this model. |
Set<Resource> |
contexts()
Returns a Set view of the contexts contained in this model. |
boolean |
equals(Object o)
|
Model |
filter(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Returns a view of the statements with the specified subject, predicate, object and (optionally) context. |
String |
getNamespace(String prefix)
Gets the namespace that is associated with the specified prefix, if any. |
Map<String,String> |
getNamespaces()
Gets the map that contains the assigned namespaces. |
int |
hashCode()
|
Iterator |
iterator()
|
Literal |
objectLiteral()
Utility method that casts the return value of Model.objectValue() to a
Literal, or throws a ModelUtilException if that value is not a Literal. |
Resource |
objectResource()
Utility method that casts the return value of Model.objectValue() to a
Resource, or throws a ModelUtilException if that value is not a Resource. |
Set<Value> |
objects()
Returns a Set view of the objects contained in this model. |
String |
objectString()
Utility method that returns the string value of Model.objectValue(). |
URI |
objectURI()
Utility method that casts the return value of Model.objectValue() to a
URI, or throws a ModelUtilException if that value is not a URI. |
Value |
objectValue()
Gets the object of the statement(s). |
Set<URI> |
predicates()
Returns a Set view of the predicates contained in this model. |
boolean |
remove(Object o)
|
boolean |
remove(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Removes statements with the specified subject, predicate, object and (optionally) context exist in this model. |
void |
removeNamespace(String prefix)
Removes a namespace declaration by removing the association between a prefix and a namespace name. |
String |
setNamespace(String prefix,
String name)
Sets the prefix for a namespace. |
int |
size()
|
Set<Resource> |
subjects()
Returns a Set view of the subjects contained in this model. |
| Methods inherited from class java.util.AbstractSet |
|---|
removeAll |
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Set |
|---|
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray |
| Constructor Detail |
|---|
public LinkedHashModel()
public LinkedHashModel(Collection<? extends Statement> c)
public LinkedHashModel(int size)
public LinkedHashModel(Map<String,String> namespaces,
Collection<? extends Statement> c)
public LinkedHashModel(Map<String,String> namespaces)
public LinkedHashModel(Map<String,String> namespaces,
int size)
| Method Detail |
|---|
public String getNamespace(String prefix)
Model
getNamespace in interface Modelprefix - A namespace prefix.
public Map<String,String> getNamespaces()
Model
getNamespaces in interface Model
public String setNamespace(String prefix,
String name)
Model
setNamespace in interface Modelprefix - The new prefix.name - The namespace name that the prefix maps to.public void removeNamespace(String prefix)
Model
removeNamespace in interface Modelprefix - The namespace prefix of which the assocation with a namespace name
is to be removed.public int size()
size in interface Collection<Statement>size in interface Set<Statement>size in class AbstractCollection<Statement>public boolean add(Statement st)
add in interface Collection<Statement>add in interface Set<Statement>add in class AbstractCollection<Statement>
public boolean add(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Model
add in interface Modelsubj - The statement's subject.pred - The statement's predicate.obj - The statement's object.contexts - The contexts to add statements to.public void clear()
clear in interface Collection<Statement>clear in interface Set<Statement>clear in class AbstractCollection<Statement>public boolean remove(Object o)
remove in interface Collection<Statement>remove in interface Set<Statement>remove in class AbstractCollection<Statement>public boolean contains(Object o)
contains in interface Collection<Statement>contains in interface Set<Statement>contains in class AbstractCollection<Statement>public Iterator iterator()
iterator in interface Iterable<Statement>iterator in interface Collection<Statement>iterator in interface Set<Statement>iterator in class AbstractCollection<Statement>
public boolean contains(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Model
Examples: model.contains(s1, null, null) is true if any
statements in this model have subject s1,
model.contains(null, null, null, c1) is true if any statements in
this model have context c1,
model.contains(null, null, null, (Resource)null) is true if any
statements in this model have no associated context,
model.contains(null, null, null, c1, c2, c3) is true if any
statements in this model have context c1, c2 or
c3.
contains in interface Modelsubj - The subject of the statements to match, null to match
statements with any subject.pred - The predicate of the statements to match, null to match
statements with any predicate.obj - The object of the statements to match, null to match
statements with any object.contexts - The contexts of the statements to match. If no contexts are
specified, statements will match disregarding their context. If one
or more contexts are specified, statements with a context matching
one of these will match.
true if statements match the specified pattern.
public boolean remove(Resource subj,
URI pred,
Value obj,
Resource... contexts)
Model
Examples: model.remove(s1, null, null) removes any statements in
this model have subject s1,
model.remove(null, null, null, c1) removes any statements in this
model have context c1,
model.remove(null, null, null, (Resource)null) removes any
statements in this model have no associated context,
model.remove(null, null, null, c1, c2, c3) removes any statements
in this model have context c1, c2 or c3.
remove in interface Modelsubj - The subject of the statements to remove, null to remove
statements with any subject.pred - The predicate of the statements to remove, null to remove
statements with any predicate.obj - The object of the statements to remove, null to remove
statements with any object.contexts - The contexts of the statements to remove. If no contexts are
specified, statements will be removed disregarding their context.
If one or more contexts are specified, statements with a context
matching one of these will be removed.
true if one or more statements have been removed.public boolean clear(Resource... contexts)
Model
clear in interface Modelcontexts - The context of the statements to remove.
true if one or more statements have been removed.
public Model filter(Resource subj,
URI pred,
Value obj,
Resource... contexts)
ModelThe returned model is backed by this Model, so changes to this Model are reflected in the returned model, and vice-versa. If this Model is modified while an iteration over the returned model is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The model supports element removal, which removes the corresponding statement from this Model, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. The statements passed to the add and addAll operations must match the parameter pattern.
Examples: model.filter(s1, null, null) matches all statements
that have subject s1,
model.filter(null, null, null, c1) matches all statements that
have context c1,
model.filter(null, null, null, (Resource)null) matches all
statements that have no associated context,
model.filter(null, null, null, c1, c2, c3) matches all statements
that have context c1, c2 or c3.
filter in interface Modelsubj - The subject of the statements to match, null to match
statements with any subject.pred - The predicate of the statements to match, null to match
statements with any predicate.obj - The object of the statements to match, null to match
statements with any object.contexts - The contexts of the statements to match. If no contexts are
specified, statements will match disregarding their context. If one
or more contexts are specified, statements with a context matching
one of these will match.
public Set<Resource> subjects()
ModelSet view of the subjects contained in this model. The
set is backed by the model, so changes to the model are reflected in the
set, and vice-versa. If the model is modified while an iteration over the
set is in progress (except through the iterator's own remove
operation), the results of the iteration are undefined. The set supports
element removal, which removes the corresponding statement from the model,
via the Iterator.remove, Set.remove, removeAll,
retainAll, and clear operations. It does not support the
add or addAll operations if the parameters pred
or obj are null.
subjects in interface Modelpublic Set<URI> predicates()
ModelSet view of the predicates contained in this model. The
set is backed by the model, so changes to the model are reflected in the
set, and vice-versa. If the model is modified while an iteration over the
set is in progress (except through the iterator's own remove
operation), the results of the iteration are undefined. The set supports
element removal, which removes the corresponding statement from the model,
via the Iterator.remove, Set.remove, removeAll,
retainAll, and clear operations. It does not support the
add or addAll operations if the parameters subj
or obj are null.
predicates in interface Modelpublic Set<Value> objects()
ModelSet view of the objects contained in this model. The set
is backed by the model, so changes to the model are reflected in the set,
and vice-versa. If the model is modified while an iteration over the set
is in progress (except through the iterator's own remove
operation), the results of the iteration are undefined. The set supports
element removal, which removes the corresponding statement from the model,
via the Iterator.remove, Set.remove, removeAll,
retainAll, and clear operations. It does not support the
add or addAll operations if the parameters subj
or pred are null.
objects in interface Modelpublic Set<Resource> contexts()
ModelSet view of the contexts contained in this model. The
set is backed by the model, so changes to the model are reflected in the
set, and vice-versa. If the model is modified while an iteration over the
set is in progress (except through the iterator's own remove
operation), the results of the iteration are undefined. The set supports
element removal, which removes the corresponding statement from the model,
via the Iterator.remove, Set.remove, removeAll,
retainAll, and clear operations. It does not support the
add or addAll operations if the parameters subj
, pred or obj are null.
contexts in interface Model
public Value objectValue()
throws ModelException
ModelModelException
is thrown if this is not the case.
objectValue in interface ModelModelException - If the statements matched by the specified parameters have more
than one unique object.
public Literal objectLiteral()
throws ModelException
ModelModel.objectValue() to a
Literal, or throws a ModelUtilException if that value is not a Literal.
objectLiteral in interface ModelModelException - If such an exception is thrown by Model.objectValue() or if its
return value is not a Literal.
public Resource objectResource()
throws ModelException
ModelModel.objectValue() to a
Resource, or throws a ModelUtilException if that value is not a Resource.
objectResource in interface ModelModelException - If such an exception is thrown by Model.objectValue() or if its
return value is not a Resource.
public URI objectURI()
throws ModelException
ModelModel.objectValue() to a
URI, or throws a ModelUtilException if that value is not a URI.
objectURI in interface ModelModelException - If such an exception is thrown by Model.objectValue() or if its
return value is not a URI.
public String objectString()
throws ModelException
ModelModel.objectValue().
objectString in interface ModelModelException - If the statements matched by the specified parameters have more
than one unique object.public int hashCode()
hashCode in interface Collection<Statement>hashCode in interface Set<Statement>hashCode in class AbstractSet<Statement>public boolean equals(Object o)
equals in interface Collection<Statement>equals in interface Set<Statement>equals in class AbstractSet<Statement>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||