Ontolofy models.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.apache.jena.shared.PrefixMappingAPrefixMappingthat contains the "standard" for OWL2 prefixes we know about, viz rdf, rdfs, xsd, and owl. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.graph.GraphCreates default (in-memory) graph implementation.static org.apache.jena.rdf.model.ModelCreates default (in-memory) RDF Model implementation.static org.apache.jena.rdf.model.ModelcreateDefaultModel(org.apache.jena.graph.Graph graph) Creates default RDF Model implementation wrapping the given graph.static OntModelCreates a fresh in-memory Ontology RDF Model with default personalities.static OntModelcreateModel(String uri, GraphRepository repository) Creates Ontology Model associated withOntSpecification.OWL2_DL_MEM_BUILTIN_RDFS_INFspec.static OntModelcreateModel(org.apache.jena.graph.Graph graph) Creates an Ontology RDF Model wrapper around the given graph with default personalities.static OntModelcreateModel(org.apache.jena.graph.Graph graph, OntPersonality personality) Creates an Ontology RDF Model wrapper around the given graph with given personalities.static OntModelcreateModel(org.apache.jena.graph.Graph graph, OntPersonality personality, org.apache.jena.reasoner.Reasoner reasoner) Creates anOntology Modelwhich isInference Model.static OntModelcreateModel(org.apache.jena.graph.Graph graph, OntSpecification spec) Creates an Ontology Model according to the specified specification.static OntModelcreateModel(org.apache.jena.graph.Graph graph, OntSpecification spec, GraphRepository repository) Creates an Ontology Model according to the specified specification.static OntModelcreateModel(OntSpecification spec) Creates an Ontology Model according to the specified specification.static OntModelcreateModel(OntSpecification spec, GraphRepository repository) Creates an anonymous Ontology Model according to the specified specification.static org.apache.jena.graph.GraphcreateOntGraph(org.apache.jena.graph.Node name, GraphRepository repository) Creates ontology graph.static UnionGraphcreateUnionGraph(org.apache.jena.graph.Graph base) Wraps the givenbasegraph asUnionGraphstatic OntModelgetModelOrNull(String uri, OntSpecification spec, GraphRepository repository) static OntModelgetModelOrNull(org.apache.jena.graph.Node name, OntSpecification spec, GraphRepository repository) static voidinit()Initializes Jena System.
-
Field Details
-
STANDARD
public static final org.apache.jena.shared.PrefixMapping STANDARDAPrefixMappingthat 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 givenbasegraph 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-Graphpersonality-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 Modelwhich isInference Model. The specified graph and its subgraphs (if any) must not beInfGraph.- Parameters:
graph-Graphpersonality-OntPersonalityreasoner-Reasoner- Returns:
OntModel- See Also:
-
createModel
Creates Ontology Model associated withOntSpecification.OWL2_DL_MEM_BUILTIN_RDFS_INFspec. Therepositorymanages all the dependencies. SeecreateModel(Graph, OntSpecification, GraphRepository).- Parameters:
uri- String, subject ofuri rdf:type owl:Ontologystatement, can benullfor anonymous ontologyrepository-GraphRepository- Returns:
OntModel
-
createModel
Creates an anonymous Ontology Model according to the specified specification. Therepositorymanages all the dependencies. Note that ifrepositoryisPersistentGraphRepository, encapsulatedGraphMakerwill be used to create graphs. See alsocreateModel(Graph, OntSpecification, GraphRepository).- Parameters:
spec-OntSpecificationrepository-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. Therepositorymanages all the dependencies (imports closure).Note that for consistency it is necessary to work only through the
OntModelorUnionGraphinterfaces. Working directly with theUnionGraph.getBaseGraph()orrepositorymay break the state. Imports closure control is performed viaUnionGraph.Listener, any ontological graphs in therepositoryis wrapped asUnionGraph,InfGraphare not stored in therepository. When adding subgraph using theUnionGraph.addSubGraph(Graph)method a statementa owl:import bwill be added. In turns, adding a statementa owl:import bwill 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 changeOntIDwill causeOntJenaException.IllegalArgumentif the ontology is in some other ontologies' import closure.This method can also be used to retrieve
OntModelfrom therepository: it returns a new instance ofOntModelwrapping the existingUnionGraphif it is present in therepository.- Parameters:
graph-Graphornullto create anonymous Graph automatically; the instance (new or provided) will be wrapped asUnionGraph(if it is not alreadyUnionGraph)spec-OntSpecificationrepository-GraphRepository; will containUnionGraphs- Returns:
OntModel- See Also:
-
getModelOrNull
public static OntModel getModelOrNull(String uri, OntSpecification spec, GraphRepository repository) FindsOntModelin therepository, returningnullif there is no ontology with the specifieduri. The method constructs newOntModelinstance, 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; notnullspec-OntSpecificationrepository-GraphRepository- Returns:
OntModelornullif there is no such ontology
-
getModelOrNull
public static OntModel getModelOrNull(org.apache.jena.graph.Node name, OntSpecification spec, GraphRepository repository) FindsOntModelin therepository, returningnullif there is no ontology with the specifiedname. The method constructs newOntModelinstance, wrapping the foundUnionGraph.- Parameters:
name-Nodeontology name, URI or blankspec-OntSpecificationrepository-GraphRepository- Returns:
OntModelornullif 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
-