Package org.phyloref.jphyloref.helpers
Class OWLHelper
java.lang.Object
org.phyloref.jphyloref.helpers.OWLHelper
public final class OWLHelper
extends java.lang.Object
OWLHelper contains methods simplify accessing information from the OWL API.
- Author:
- Gaurav Vaidya
-
Constructor Summary
Constructors Constructor Description OWLHelper() -
Method Summary
Modifier and Type Method Description static java.util.Map<java.lang.String,java.util.Set<java.lang.String>>getAnnotationLiteralsForEntity(org.semanticweb.owlapi.model.OWLOntology ontology, org.semanticweb.owlapi.model.OWLEntity entity, org.semanticweb.owlapi.model.OWLAnnotationProperty annotationProperty)Return a Map that contains all known values for a given annotation property for a given OWL entity, grouped by language tags.static java.util.Set<java.lang.String>getAnnotationLiteralsForEntity(org.semanticweb.owlapi.model.OWLOntology ontology, org.semanticweb.owlapi.model.OWLEntity entity, org.semanticweb.owlapi.model.OWLAnnotationProperty annotationProperty, java.util.List<java.lang.String> langs)Extract literal values for an annotation property applied to an OWL entity in an ontology for a particular set of languages.static org.semanticweb.owlapi.model.OWLAnnotationPropertygetLabelProperty(org.semanticweb.owlapi.model.OWLOntology ontology)Returns OWL property rdfs:label, using a cache so we don't need to load the property using the data property.static java.util.Set<java.lang.String>getLabelsInEnglish(org.semanticweb.owlapi.model.OWLNamedIndividual individual, org.semanticweb.owlapi.model.OWLOntology ontology)Return a list of labels for an OWLNamedIndividual in English or (if no such label is known) with no language provided.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
OWLHelper
public OWLHelper()
-
-
Method Details
-
getLabelProperty
public static org.semanticweb.owlapi.model.OWLAnnotationProperty getLabelProperty(org.semanticweb.owlapi.model.OWLOntology ontology)Returns OWL property rdfs:label, using a cache so we don't need to load the property using the data property.- Parameters:
ontology- The ontology whose OWLAnnotationProperty we want.- Returns:
- The OWLAnnotationProperty of rdfs:label.
-
getLabelsInEnglish
public static java.util.Set<java.lang.String> getLabelsInEnglish(org.semanticweb.owlapi.model.OWLNamedIndividual individual, org.semanticweb.owlapi.model.OWLOntology ontology)Return a list of labels for an OWLNamedIndividual in English or (if no such label is known) with no language provided.- Parameters:
individual- The OWLNamedIndividual whose labels need to be retrieved.ontology- The ontology within which this individual is defined.- Returns:
- A list of labels as Java Strings.
-
getAnnotationLiteralsForEntity
public static java.util.Set<java.lang.String> getAnnotationLiteralsForEntity(org.semanticweb.owlapi.model.OWLOntology ontology, org.semanticweb.owlapi.model.OWLEntity entity, org.semanticweb.owlapi.model.OWLAnnotationProperty annotationProperty, java.util.List<java.lang.String> langs)Extract literal values for an annotation property applied to an OWL entity in an ontology for a particular set of languages. If no literals are found for any of the specified languages, we will return literals that don't have an explicit language tag (i.e. an xsd:string instead of an rdfs:langString). If no such literals are known, we return an empty set.- Parameters:
ontology- The ontology containing the entity and the annotation property to extractentity- The entity to extract annotations forannotationProperty- The annotation property to extract (usually rdfs:label)langs- Languages to extract annotation literals for, in order of importance- Returns:
- Set of annotation property values for the first matched language, or those associated with no languages
-
getAnnotationLiteralsForEntity
public static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getAnnotationLiteralsForEntity(org.semanticweb.owlapi.model.OWLOntology ontology, org.semanticweb.owlapi.model.OWLEntity entity, org.semanticweb.owlapi.model.OWLAnnotationProperty annotationProperty)Return a Map that contains all known values for a given annotation property for a given OWL entity, grouped by language tags. The special language tag "" is used as the key for literals without an explicit language tag.- Parameters:
ontology- The ontology containing the OWL entity and the annotation property to queryentity- The OWL entity to queryannotationProperty- The annotation property to query- Returns:
- A Map of annotation values organized into Sets by language.
-