Ontolofy model
s.-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.apache.jena.shared.PrefixMapping
APrefixMapping
that contains the "standard" for OWL2 prefixes we know about, viz rdf, rdfs, xsd, and owl. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.graph.Graph
Creates default (in-memory) graph implementation.static org.apache.jena.rdf.model.Model
Creates default (in-memory) RDF Model implementation.static org.apache.jena.rdf.model.Model
createDefaultModel
(org.apache.jena.graph.Graph graph) Creates default RDF Model implementation wrapping the given graph.static OntModel
Creates a fresh in-memory Ontology RDF Model with default personalities.static OntModel
createModel
(String uri, GraphRepository repository) Creates Ontology Model associated withOntSpecification.OWL2_DL_MEM_BUILTIN_RDFS_INF
spec.static OntModel
createModel
(org.apache.jena.graph.Graph graph) Creates an Ontology RDF Model wrapper around the given graph with default personalities.static OntModel
createModel
(org.apache.jena.graph.Graph graph, OntPersonality personality) Creates an Ontology RDF Model wrapper around the given graph with given personalities.static OntModel
createModel
(org.apache.jena.graph.Graph graph, OntPersonality personality, org.apache.jena.reasoner.Reasoner reasoner) Creates anOntology Model
which isInference Model
.static OntModel
createModel
(org.apache.jena.graph.Graph graph, OntSpecification spec) Creates an Ontology Model according to the specified specification.static OntModel
createModel
(org.apache.jena.graph.Graph graph, OntSpecification spec, GraphRepository repository) Creates an Ontology Model according to the specified specification.static OntModel
createModel
(OntSpecification spec) Creates an Ontology Model according to the specified specification.static OntModel
createModel
(OntSpecification spec, GraphRepository repository) Creates an anonymous Ontology Model according to the specified specification.static org.apache.jena.graph.Graph
createOntGraph
(org.apache.jena.graph.Node name, GraphRepository repository) Creates ontology graph.static UnionGraph
createUnionGraph
(org.apache.jena.graph.Graph base) Wraps the givenbase
graph asUnionGraph
static OntModel
getModelOrNull
(String uri, OntSpecification spec, GraphRepository repository) static OntModel
getModelOrNull
(org.apache.jena.graph.Node name, OntSpecification spec, GraphRepository repository) static void
init()
Initializes Jena System.
-
Field Details
-
STANDARD
public static final org.apache.jena.shared.PrefixMapping STANDARDAPrefixMapping
that contains the "standard" for OWL2 prefixes we know about, viz rdf, rdfs, xsd, and owl.
-
-
Constructor Details
-
OntModelFactory
public OntModelFactory()
-
-
Method Details
-
init
public static void init()Initializes Jena System. -
createDefaultGraph
public static org.apache.jena.graph.Graph createDefaultGraph()Creates default (in-memory) graph implementation.- Returns:
Graph
-
createUnionGraph
Wraps the givenbase
graph asUnionGraph
- Parameters:
base
-Graph
- Returns:
UnionGraph
-
createDefaultModel
public static org.apache.jena.rdf.model.Model createDefaultModel()Creates default (in-memory) RDF Model implementation.- Returns:
Model
- See Also:
-
ModelFactory.createDefaultModel()
-
createDefaultModel
public static org.apache.jena.rdf.model.Model createDefaultModel(org.apache.jena.graph.Graph graph) Creates default RDF Model implementation wrapping the given graph.- Parameters:
graph
-Graph
, notnull
- Returns:
Model
- See Also:
-
ModelFactory.createDefaultModel()
-
createModel
Creates a fresh in-memory Ontology RDF Model with default personalities.- Returns:
OntModel
-
createModel
Creates an Ontology RDF Model wrapper around the given graph with default personalities.- Parameters:
graph
-Graph
- Returns:
OntModel
-
createModel
Creates an Ontology RDF Model wrapper around the given graph with given personalities.- Parameters:
graph
-Graph
personality
-OntPersonality
- Returns:
OntModel
-
createModel
Creates an Ontology Model according to the specified specification.- Parameters:
spec
-OntSpecification
- Returns:
OntModel
-
createModel
Creates an Ontology Model according to the specified specification.- Parameters:
graph
-Graph
(base graph)spec
-OntSpecification
- Returns:
OntModel
-
createModel
public static OntModel createModel(org.apache.jena.graph.Graph graph, OntPersonality personality, org.apache.jena.reasoner.Reasoner reasoner) Creates anOntology Model
which isInference Model
. The specified graph and its subgraphs (if any) must not beInfGraph
.- Parameters:
graph
-Graph
personality
-OntPersonality
reasoner
-Reasoner
- Returns:
OntModel
- See Also:
-
createModel
Creates Ontology Model associated withOntSpecification.OWL2_DL_MEM_BUILTIN_RDFS_INF
spec. Therepository
manages all the dependencies. SeecreateModel(Graph, OntSpecification, GraphRepository)
.- Parameters:
uri
- String, subject ofuri rdf:type owl:Ontology
statement, can benull
for anonymous ontologyrepository
-GraphRepository
- Returns:
OntModel
-
createModel
Creates an anonymous Ontology Model according to the specified specification. Therepository
manages all the dependencies. Note that ifrepository
isPersistentGraphRepository
, encapsulatedGraphMaker
will be used to create graphs. See alsocreateModel(Graph, OntSpecification, GraphRepository)
.- Parameters:
spec
-OntSpecification
repository
-GraphRepository
- Returns:
OntModel
-
createModel
public static OntModel createModel(org.apache.jena.graph.Graph graph, OntSpecification spec, GraphRepository repository) Creates an Ontology Model according to the specified specification. Therepository
manages all the dependencies (imports closure).Note that for consistency it is necessary to work only through the
OntModel
orUnionGraph
interfaces. Working directly with theUnionGraph.getBaseGraph()
orrepository
may break the state. Imports closure control is performed viaUnionGraph.Listener
, any ontological graphs in therepository
is wrapped asUnionGraph
,InfGraph
are not stored in therepository
. When adding subgraph using theUnionGraph.addSubGraph(Graph)
method a statementa owl:import b
will be added. In turns, adding a statementa owl:import b
will cause adding a subgraph. If a subgraph cannot be found in therepository
, an empty ontology graph will be associated with the correspondingowl:import
. The specified graph and its subgraphs (if any) must not beInfGraph
. Note that the method adds ontology headers to each subgraph of the specified graph, including itself. Also note that attempt to changeOntID
will causeOntJenaException.IllegalArgument
if the ontology is in some other ontologies' import closure.This method can also be used to retrieve
OntModel
from therepository
: it returns a new instance ofOntModel
wrapping the existingUnionGraph
if it is present in therepository
.- Parameters:
graph
-Graph
ornull
to create anonymous Graph automatically; the instance (new or provided) will be wrapped asUnionGraph
(if it is not alreadyUnionGraph
)spec
-OntSpecification
repository
-GraphRepository
; will containUnionGraph
s- Returns:
OntModel
- See Also:
-
getModelOrNull
public static OntModel getModelOrNull(String uri, OntSpecification spec, GraphRepository repository) FindsOntModel
in therepository
, returningnull
if there is no ontology with the specifieduri
. The method constructs newOntModel
instance, wrapping the foundUnionGraph
.- Parameters:
uri
- ontology name: object from the statement<ont> owl:versionIri <name>
or subject from the statement<name> rdf:type owl:Ontology
; notnull
spec
-OntSpecification
repository
-GraphRepository
- Returns:
OntModel
ornull
if there is no such ontology
-
getModelOrNull
public static OntModel getModelOrNull(org.apache.jena.graph.Node name, OntSpecification spec, GraphRepository repository) FindsOntModel
in therepository
, returningnull
if there is no ontology with the specifiedname
. The method constructs newOntModel
instance, wrapping the foundUnionGraph
.- Parameters:
name
-Node
ontology name, URI or blankspec
-OntSpecification
repository
-GraphRepository
- Returns:
OntModel
ornull
if there is no such ontology
-
createOntGraph
public static org.apache.jena.graph.Graph createOntGraph(org.apache.jena.graph.Node name, GraphRepository repository) Creates ontology graph.- Parameters:
name
-Node
, notnull
- ontology header.repository
-GraphRepository
, notnull
- Returns:
Graph
-