Package helper
Class OWLMaster
java.lang.Object
helper.OWLMaster
Contains helper methods for interacting with OWL knowledge bases.
- Author:
- Afonso Caniço, Afonso Sampaio, Gustavo Ferreira, Samuel Correia
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllRelationNames
(String kbPath) Gets the set of the names of all OWL relations (object and data properties, built-ins, etc.) in the ontology in alphabetical order.static String
getEncodedOntologyID
(org.semanticweb.owlapi.model.OWLOntology ontology) Gets the encoded ID of an OWL ontology.getOntologyClassNames
(String kbPath) Gets the set of the names of all OWL Classes in the ontology in alphabetical order.getOntologyDataPropertyNames
(String kbPath) Gets the set of the names of all OWL Data Properties in the ontology in alphabetical order.static org.semanticweb.owlapi.model.OWLOntology
getOntologyFromFile
(File kbFile) Loads an OWL knowledge base from the given file.static org.semanticweb.owlapi.model.OWLOntology
getOntologyFromFile
(String kbPath) Loads an OWL knowledge base from the file at the given path.getOntologyIndividualNames
(String kbPath) Gets the set of the names of all OWL Inidividuals in the ontology in alphabetical order.getOntologyObjectPropertyNames
(String kbPath) Gets the set of the names of all OWL Object Properties in the ontology in alphabetical order.static SortedSet<org.semanticweb.owlapi.model.OWLEntity>
getOntologySignature
(String kbPath) Loads an ontology from a given OWL knowledge base file and returns its signature.static SortedSet<org.semanticweb.owlapi.model.OWLEntity>
getOntologySignature
(org.semanticweb.owlapi.model.OWLOntology ontology) Gets the signature of an ontology, i.e. the set of all entities in that ontology.getPrefixedBuiltInNames
(String prefix) Gets every SWRLAPI built-in with the specified prefix.static boolean
isValidOntologyFile
(File file) Is the specified file a valid OWL document?static void
purgeOntologyMap
(String kbPath) Deletes a mapping from the stored ontology map.static org.swrlapi.sqwrl.SQWRLResult
Queries an ontology from a given knowledge base file using the given SQWRL query string.static org.swrlapi.sqwrl.SQWRLResult
Queries an ontology using the given SQWRL query string.
-
Constructor Details
-
OWLMaster
public OWLMaster()
-
-
Method Details
-
purgeOntologyMap
Deletes a mapping from the stored ontology map.- Parameters:
kbPath
- The knowledge base location of the ontology to be removed.
-
getOntologyFromFile
Loads an OWL knowledge base from the file at the given path.- Parameters:
kbPath
- The path to the OWL knowledge base file.- Returns:
- The ontology present in the specified knowledge base.
-
getOntologyFromFile
Loads an OWL knowledge base from the given file.- Parameters:
kbFile
- An OWL knowledge base file.- Returns:
- The ontology present in the specified knowledge base.
-
getOntologySignature
public static SortedSet<org.semanticweb.owlapi.model.OWLEntity> getOntologySignature(org.semanticweb.owlapi.model.OWLOntology ontology) Gets the signature of an ontology, i.e. the set of all entities in that ontology.- Parameters:
ontology
- The OWL ontology you want to get the signature from.- Returns:
- The signature (set of entities) of the given ontology.
-
getOntologySignature
Loads an ontology from a given OWL knowledge base file and returns its signature.- Parameters:
kbPath
- The path to the OWL knowledge base file.- Returns:
- The signature (set of entities) of the loaded ontology.
-
getOntologyClassNames
Gets the set of the names of all OWL Classes in the ontology in alphabetical order.- Parameters:
kbPath
- The path to the ontology's knowledge base.- Returns:
- A set of strings corresponding to the names of every OWLClass in the given ontology's signature.
-
getOntologyObjectPropertyNames
Gets the set of the names of all OWL Object Properties in the ontology in alphabetical order.- Parameters:
kbPath
- The path to the ontology's knowledge base.- Returns:
- A set of strings corresponding to the names of every OWL Object Property in the given ontology's signature.
-
getOntologyDataPropertyNames
Gets the set of the names of all OWL Data Properties in the ontology in alphabetical order.- Parameters:
kbPath
- The path to the ontology's knowledge base.- Returns:
- A set of strings corresponding to the names of every OWL Data Property in the given ontology's signature.
-
getAllRelationNames
Gets the set of the names of all OWL relations (object and data properties, built-ins, etc.) in the ontology in alphabetical order.- Parameters:
kbPath
- The path to the ontology's knowledge base.- Returns:
- A set of strings corresponding to the names of every relation (object/data property, built-in, etc.) in the given ontology.
-
getOntologyIndividualNames
Gets the set of the names of all OWL Inidividuals in the ontology in alphabetical order.- Parameters:
kbPath
- The path to the ontology's knowledge base.- Returns:
- A set of strings corresponding to the names of every OWL Individual in the given ontology's signature.
-
getPrefixedBuiltInNames
Gets every SWRLAPI built-in with the specified prefix.- Parameters:
prefix
- The built-in prefix. E.g: 'swrlb', 'sqwrl', etc.- Returns:
- The set of all (prefixed) names of the built-ins associated with the given prefix.
-
query
public static org.swrlapi.sqwrl.SQWRLResult query(org.semanticweb.owlapi.model.OWLOntology ontology, String query) Queries an ontology using the given SQWRL query string.- Parameters:
ontology
- The ontology to query.query
- The SQWRL query to execute.- Returns:
- The result (SQWRLResult instance) of the query execution.
-
query
Queries an ontology from a given knowledge base file using the given SQWRL query string.- Parameters:
kbPath
- The path to the desired ontology's knowledge base file.query
- The SQWRL query to execute.- Returns:
- The result (SQWRLResult instance) of the query execution.
-
isValidOntologyFile
Is the specified file a valid OWL document?- Parameters:
file
- The file to check.- Returns:
- True if the file is a valid, well-formed OWL file; False, otherwise.
-
getEncodedOntologyID
Gets the encoded ID of an OWL ontology.- Parameters:
ontology
- An OWL ontology instance.- Returns:
- A filename-ready version of the given ontology's ID.
-