public class GraphNode extends Object
UnsupportedOperationException
it the underlying TripleCollection in immutable (i.e. is a Graph
.Constructor and Description |
---|
GraphNode(Resource resource,
TripleCollection graph)
Create a GraphNode representing resource within graph.
|
Modifier and Type | Method and Description |
---|---|
void |
addInverseProperty(UriRef predicate,
Resource subject)
Adds a property to the node with the inverse of the specified predicate and object
In other words
subject will be related via the property relation to this node. |
void |
addProperty(UriRef predicate,
Resource object)
Adds a property to the node with the specified predicate and object
|
void |
addPropertyValue(UriRef property,
Object value)
Coverts the value into a typed literals and sets it as object of the
specified property
|
List<Resource> |
asList()
creates and returns an
RdfList for the node and
TripleCollection represented by this object. |
int |
countObjects(UriRef property)
Count the number of triples in the underlying triple-collection
with this node as subject and a specified property as predicate.
|
int |
countSubjects(UriRef property)
Count the number of triples in the underlying triple-collection
with this node as object and a specified property as predicate.
|
void |
deleteNodeContext()
Deletes the context of a node
|
void |
deleteProperties(UriRef predicate)
Deletes all statement with the current node as subject and the specified
predicate
|
void |
deleteProperty(UriRef predicate,
Resource object)
Delete property to the node with the specified predicate and object
|
boolean |
equals(Object obj) |
TripleCollection |
getGraph()
Gets the graph the node represented by this instance is in
|
Iterator<UriRef> |
getInverseProperties()
|
Iterator<Literal> |
getLiterals(UriRef property) |
Resource |
getNode()
Gets the unwrapped node
|
Graph |
getNodeContext()
The context of a node are the triples containing a node
as subject or object and recursively the context of the b-nodes in any
of these statements.
|
Iterator<GraphNode> |
getObjectNodes(UriRef property)
Returns a iterator containing all objects of the triples where this
graph node is the subject and has the specified property.
|
Iterator<Resource> |
getObjects(UriRef property)
Get the objects of statements with this node as subject and a specified
property as predicate.
|
Iterator<UriRef> |
getProperties()
|
Iterator<GraphNode> |
getSubjectNodes(UriRef property)
Returns a iterator containing all subjects of the triples where this
graph node is the object and has the specified property.
|
Iterator<NonLiteral> |
getSubjects(UriRef property)
Get the subjects of statements with this node as object and a specified
property as predicate.
|
Iterator<UriRef> |
getUriRefObjects(UriRef property) |
int |
hashCode() |
boolean |
hasProperty(UriRef property,
Resource object)
Checks wether this node has the given property with the given value.
|
java.util.concurrent.locks.Lock |
readLock() |
GraphNode |
replaceWith(NonLiteral replacement)
Replaces the graph node resouce with the specified
NonLiteral . |
GraphNode |
replaceWith(NonLiteral replacement,
boolean checkPredicates)
Replaces the graph node resouce with the specified
NonLiteral . |
String |
toString() |
java.util.concurrent.locks.Lock |
writeLock() |
public GraphNode(Resource resource, TripleCollection graph)
resource
- the resource this GraphNode representsgraph
- the TripleCollection that describes the resourcepublic TripleCollection getGraph()
public Resource getNode()
public void deleteNodeContext()
getNodeContext()
public Graph getNodeContext()
public int countObjects(UriRef property)
property
- the property to be examinedpublic Iterator<Resource> getObjects(UriRef property)
property
- the propertypublic boolean hasProperty(UriRef property, Resource object)
property
- object
- public int countSubjects(UriRef property)
property
- the property to be examinedpublic Iterator<NonLiteral> getSubjects(UriRef property)
property
- the propertypublic Iterator<UriRef> getProperties()
Iterator
<UriRef
>.
You can use getObjects(UriRef property)
to get the values of
each propertypublic Iterator<UriRef> getInverseProperties()
Iterator
<UriRef
>.
You can use getSubject(UriRef property)
to get the values of
each inverse propertypublic void addProperty(UriRef predicate, Resource object)
predicate
- object
- public void addPropertyValue(UriRef property, Object value)
property
- the predicate of the triple to be createdvalue
- the value of the typed literal objectpublic void addInverseProperty(UriRef predicate, Resource subject)
subject
will be related via the property relation
to this node.predicate
- subject
- public List<Resource> asList()
RdfList
for the node and
TripleCollection represented by this object.public void deleteProperties(UriRef predicate)
predicate
- public void deleteProperty(UriRef predicate, Resource object)
predicate
- object
- public GraphNode replaceWith(NonLiteral replacement)
NonLiteral
.
The resource is only replaced where it is either subject or object.replacement
- public GraphNode replaceWith(NonLiteral replacement, boolean checkPredicates)
NonLiteral
.
Over the boolean checkPredicate
it can be specified if the
resource should also be replaced where it is used as predicate.replacement
- checkPredicates
- public Iterator<GraphNode> getObjectNodes(UriRef property)
GraphNode
s.property
- public Iterator<GraphNode> getSubjectNodes(UriRef property)
GraphNode
s.property
- public boolean equals(Object obj)
public java.util.concurrent.locks.Lock readLock()
public java.util.concurrent.locks.Lock writeLock()
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.