- 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.Implementation
Represents the given implementation factory asJena Implementation Factory
.default boolean
canCreateInGraph
(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Answerstrue
iff the modifying of thegraph
is allowed by this implementation for the encapsulated object's interface.boolean
canWrap
(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.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
.org.apache.jena.enhanced.EnhNode
createInstance
(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Wraps the given pair ofnode
andgraph
to a freshEnhNode
instance 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 Iterator
over thenode
s found in theEnhGraph
in the form ofEnhNode
with the interface that this factory encapsulates.default org.apache.jena.enhanced.EnhNode
wrap
(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Creates a newEnhNode
wrapping the givenNode
node 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 Iterator
over thenode
s found in theEnhGraph
in the form ofEnhNode
with 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 theEnhGraph
encapsulates the distinct graph (see alsoGraphs.isDistinct(Graph)
).- Parameters:
eg
-EnhGraph
- Returns:
ExtendedIterator
ofEnhNode
s
-
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:
true
iff thenode
can 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 ofnode
andgraph
to a freshEnhNode
instance without any checking or throwing any exception. Some implementations may returnnull
if thecanWrap(Node, EnhGraph)
returnsfalse
. Unlike the methodcreateInGraph(Node, EnhGraph)
, this method does not make any changes to the graph.- Parameters:
node
-Node
, notnull
eg
-EnhGraph
, notnull
- Returns:
EnhNode
ornull
-
wrap
default org.apache.jena.enhanced.EnhNode wrap(org.apache.jena.graph.Node node, org.apache.jena.enhanced.EnhGraph eg) Creates a newEnhNode
wrapping the givenNode
node 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
, notnull
eg
-EnhGraph
, the graph containing the node, notnull
- Returns:
EnhNode
a 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
, notnull
eg
-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) Answerstrue
iff the modifying of thegraph
is allowed by this implementation for the encapsulated object's interface.- Parameters:
node
-Node
the node to test that changes are permitted.eg
-EnhGraph
the 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
-