public class GraphNode extends Object
UnsupportedOperationException
it the underlying Graph in immutable (i.e. is a ImmutableGraph
.Constructor and Description |
---|
GraphNode(RDFTerm resource,
Graph graph)
Create a GraphNode representing resource within graph.
|
Modifier and Type | Method and Description |
---|---|
void |
addInverseProperty(IRI predicate,
RDFTerm 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(IRI predicate,
RDFTerm object)
Adds a property to the node with the specified predicate and object
|
void |
addPropertyValue(IRI property,
Object value)
Coverts the value into a typed literals and sets it as object of the
specified property
|
List<RDFTerm> |
asList()
creates and returns an
RdfList for the node and
Graph represented by this object. |
int |
countObjects(IRI property)
Count the number of triples in the underlying triple-collection
with this node as subject and a specified property as predicate.
|
int |
countSubjects(IRI 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(IRI predicate)
Deletes all statement with the current node as subject and the specified
predicate
|
void |
deleteProperty(IRI predicate,
RDFTerm object)
Delete property to the node with the specified predicate and object
|
boolean |
equals(Object obj) |
Graph |
getGraph()
Gets the graph the node represented by this instance is in
|
Iterator<IRI> |
getInverseProperties()
|
Iterator<IRI> |
getIRIObjects(IRI property) |
Iterator<Literal> |
getLiterals(IRI property) |
RDFTerm |
getNode()
Gets the unwrapped node
|
ImmutableGraph |
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(IRI property)
Returns a iterator containing all objects of the triples where this
graph node is the subject and has the specified property.
|
Iterator<RDFTerm> |
getObjects(IRI property)
Get the objects of statements with this node as subject and a specified
property as predicate.
|
Iterator<IRI> |
getProperties()
|
Iterator<GraphNode> |
getSubjectNodes(IRI property)
Returns a iterator containing all subjects of the triples where this
graph node is the object and has the specified property.
|
Iterator<BlankNodeOrIRI> |
getSubjects(IRI property)
Get the subjects of statements with this node as object and a specified
property as predicate.
|
int |
hashCode() |
boolean |
hasProperty(IRI property,
RDFTerm object)
Checks wether this node has the given property with the given value.
|
Lock |
readLock() |
GraphNode |
replaceWith(BlankNodeOrIRI replacement)
Replaces the graph node resouce with the specified
BlankNodeOrIRI . |
GraphNode |
replaceWith(BlankNodeOrIRI replacement,
boolean checkPredicates)
Replaces the graph node resouce with the specified
BlankNodeOrIRI . |
String |
toString() |
Lock |
writeLock() |
public Graph getGraph()
public RDFTerm getNode()
public void deleteNodeContext()
getNodeContext()
public ImmutableGraph getNodeContext()
The triples in the ImmutableGraph returned by this method contain the same bnode instances as in the original graph.
public int countObjects(IRI property)
property
- the property to be examinedpublic Iterator<RDFTerm> getObjects(IRI property)
property
- the propertypublic boolean hasProperty(IRI property, RDFTerm object)
property
- object
- public int countSubjects(IRI property)
property
- the property to be examinedpublic Iterator<BlankNodeOrIRI> getSubjects(IRI property)
property
- the propertypublic Iterator<IRI> getProperties()
Iterator
<IRI
>.
You can use getObjects(IRI property)
to get the values of
each propertypublic Iterator<IRI> getInverseProperties()
Iterator
<IRI
>.
You can use getSubject(IRI property)
to get the values of
each inverse propertypublic void addProperty(IRI predicate, RDFTerm object)
predicate
- object
- public void addPropertyValue(IRI property, Object value)
property
- the predicate of the triple to be createdvalue
- the value of the typed literal objectpublic void addInverseProperty(IRI predicate, RDFTerm subject)
subject
will be related via the property relation
to this node.predicate
- subject
- public List<RDFTerm> asList()
RdfList
for the node and
Graph represented by this object.public void deleteProperties(IRI predicate)
predicate
- public void deleteProperty(IRI predicate, RDFTerm object)
predicate
- object
- public GraphNode replaceWith(BlankNodeOrIRI replacement)
BlankNodeOrIRI
.
The resource is only replaced where it is either subject or object.replacement
- public GraphNode replaceWith(BlankNodeOrIRI replacement, boolean checkPredicates)
BlankNodeOrIRI
.
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(IRI property)
GraphNode
s.property
- public Iterator<GraphNode> getSubjectNodes(IRI property)
GraphNode
s.property
- public boolean equals(Object obj)
public Lock readLock()
public Lock writeLock()
Copyright © 2015–2022 The Apache Software Foundation. All rights reserved.