- All Known Implementing Classes:
BaseEnhNodeFactoryImpl,CommonEnhNodeFactoryImpl,CompositeEnhNodeFactoryImpl,WrappedEnhNodeFactory
public interface EnhNodeFactory
An
EnhNode factory abstraction,
that is an ONT-API analogue of the Jena Implementation Factory.
Used to bind a concrete implementation (i.e. enhanced node) and
an interface (OWL Object) with a Graph Node.
It is a part of OntPersonality mechanism to manipulate
OWL2 RDF-model objects (which happens through OntEnhGraph).
Also note, explicit links between different EnhNodeFactory factories are undesirable
(for more details see OntObjectPersonalityBuilder.add(Class, EnhNodeFactory) and
OntEnhGraph).
TODO: consider a possibility to replace EnhGraph with OntEnhGraph.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.enhanced.ImplementationRepresents the given implementation factory asJena Implementation Factory.default booleancanCreateInGraph(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Answerstrueiff the modifying of thegraphis allowed by this implementation for the encapsulated object's interface.booleancanWrap(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Checks that the wrapping (node,eg) would succeed.default org.apache.jena.enhanced.EnhNodecreateInGraph(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Makes interface-defined changes in the given graph and returns a new enhanced node, wrapping the givenNode.org.apache.jena.enhanced.EnhNodecreateInstance(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Wraps the given pair ofnodeandgraphto a freshEnhNodeinstance without any checking or throwing any exception.default Stream<org.apache.jena.enhanced.EnhNode>find(org.apache.jena.enhanced.EnhGraph eg) Lists all enhanced nodes from the graph, with the interface that this factory encapsulates.org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.enhanced.EnhNode>iterator(org.apache.jena.enhanced.EnhGraph eg) Returns anExtended Iteratorover thenodes found in theEnhGraphin the form ofEnhNodewith the interface that this factory encapsulates.default org.apache.jena.enhanced.EnhNodewrap(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Creates a newEnhNodewrapping the givenNodenode in the context of the graphEnhGraph.
-
Method Details
-
asJenaImplementation
static org.apache.jena.enhanced.Implementation asJenaImplementation(EnhNodeFactory f) throws OntJenaException Represents the given implementation factory asJena Implementation Factory.- Parameters:
f-OntPersonality, notnull- Returns:
Implementation, notnull- Throws:
OntJenaException- in case the conversion is not possible- See Also:
-
iterator
org.apache.jena.util.iterator.ExtendedIterator<org.apache.jena.enhanced.EnhNode> iterator(org.apache.jena.enhanced.EnhGraph eg) Returns anExtended Iteratorover thenodes found in theEnhGraphin the form ofEnhNodewith the interface that this factory encapsulates. It is assumed that the returned iterator is distinct (does not answer with duplicates). At least, it must be distinct if theEnhGraphencapsulates the distinct graph (see alsoGraphs.isDistinct(Graph)).- Parameters:
eg-EnhGraph- Returns:
ExtendedIteratorofEnhNodes
-
canWrap
boolean canWrap(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Checks that the wrapping (node,eg) would succeed.- Parameters:
node- node the node to test for suitabilityeg- the enhanced graph the node appears in- Returns:
trueiff thenodecan represent the type in the graph
-
createInstance
org.apache.jena.enhanced.EnhNode createInstance(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Wraps the given pair ofnodeandgraphto a freshEnhNodeinstance without any checking or throwing any exception. Some implementations may returnnullif thecanWrap(Node, EnhGraph)returnsfalse. Unlike the methodcreateInGraph(Node, EnhGraph), this method does not make any changes to the graph.- Parameters:
node-Node, notnulleg-EnhGraph, notnull- Returns:
EnhNodeornull
-
wrap
default org.apache.jena.enhanced.EnhNode wrap(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Creates a newEnhNodewrapping the givenNodenode in the context of the graphEnhGraph. Unlike the methodcreateInGraph(Node, EnhGraph), this method does not make any changes to the graph.- Parameters:
node-Node, the node to be wrapped asEnhNode, notnulleg-EnhGraph, the graph containing the node, notnull- Returns:
EnhNodea new enhanced node presenting the interface that this factory encapsulates- Throws:
OntJenaException- in case wrapping is impossible
-
createInGraph
default org.apache.jena.enhanced.EnhNode createInGraph(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Makes interface-defined changes in the given graph and returns a new enhanced node, wrapping the givenNode.- Parameters:
node-Node, the node to be wrapped asEnhNode, notnulleg-EnhGraph, the graph which would contain the resultEnhNode, notnull- Returns:
- a new enhanced node
- Throws:
OntJenaException- in case modification of graph is not allowed for the specified node
-
canCreateInGraph
default boolean canCreateInGraph(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Answerstrueiff the modifying of thegraphis allowed by this implementation for the encapsulated object's interface.- Parameters:
node-Nodethe node to test that changes are permitted.eg-EnhGraphthe graph to be changed.- Returns:
- true if creation is allowed.
-
find
Lists all enhanced nodes from the graph, with the interface that this factory encapsulates.- Parameters:
eg- the graph containing the node- Returns:
- the stream of enhanced and suitability nodes
-