Package org.obolibrary.robot
Class RelatedObjectsHelper
- java.lang.Object
-
- org.obolibrary.robot.RelatedObjectsHelper
-
public class RelatedObjectsHelper extends Object
Convenience methods to get related entities for a set of IRIs. Allowed relation options are: - ancestors - descendants - disjoints - domains - equivalents - inverses - ranges - types- Author:
- Becky Tauber
-
-
Constructor Summary
Constructors Constructor Description RelatedObjectsHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Set<org.semanticweb.owlapi.model.OWLAxiom>
filterAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> inputAxioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, List<String> axiomSelectors, List<String> baseNamespaces, boolean partial, boolean namedOnly)
Filter a set of OWLAxioms based on the provided arguments.static Set<org.semanticweb.owlapi.model.OWLAxiom>
filterAxiomsByAxiomType(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean partial, boolean namedOnly)
Given a set of OWLAxioms, a set of OWLObjects, a set of OWLAxiom Classes, a partial boolean, and a named-only boolean, return a set of OWLAxioms based on OWLAxiom type.static Set<org.semanticweb.owlapi.model.OWLAxiom>
filterCompleteAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> inputAxioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given a st of axioms, a set of objects, and a set of axiom types, return a set of axioms where all the objects in those axioms are in the set of objects.static Set<org.semanticweb.owlapi.model.OWLAxiom>
filterExternalAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, List<String> baseNamespaces)
Given a list of base namespaces and a set of axioms, return only the axioms that DO NOT have a subject in the base namespaces.static Set<org.semanticweb.owlapi.model.OWLAxiom>
filterInternalAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, List<String> baseNamespaces)
Given a list of base namespaces and a set of axioms, return only the axioms that have a subject in the base namespaces.static Set<org.semanticweb.owlapi.model.OWLAxiom>
filterPartialAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> inputAxioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given a set of axioms, a set of objects, and a set of axiom types, return a set of axioms where at least one object in those axioms is also in the set of objects.static Set<org.semanticweb.owlapi.model.OWLAxiom>
filterTautologicalAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, boolean structural)
Given a set of OWLAxioms and a structural boolean, filter for tautological axioms, i.e., those that would be true in any ontology.static Set<org.semanticweb.owlapi.model.OWLAxiom>
getAnnotationAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return the annotation axioms for all objects.protected static Set<org.semanticweb.owlapi.model.OWLAnnotation>
getAnnotations(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String annotation)
Given an IOHelper and an annotation as CURIE=..., return the OWLAnnotation object(s).static Set<org.semanticweb.owlapi.model.OWLAxiom>
getAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean partial, boolean signature)
Deprecated.static Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>>
getAxiomValues(String axiomSelector)
Given a string axiom selector, return the OWLAxiom Class type(s) or null.static Set<org.semanticweb.owlapi.model.OWLAxiom>
getCompleteAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where all the objects in those axioms are in the set of objects.static Set<org.semanticweb.owlapi.model.OWLAxiom>
getCompleteAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where all the objects in those axioms are in the set of objects.static Set<org.semanticweb.owlapi.model.OWLAxiom>
getPartialAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where at least one object in those axioms is also in the set of objects.static Set<org.semanticweb.owlapi.model.OWLAxiom>
getPartialAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where at least one object in those axioms is also in the set of objects.static Set<org.semanticweb.owlapi.model.OWLObject>
select(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, String selector)
Given an ontology, a set of objects, and a selector, return the related objects related to the set of OWL objects based on the selector.static Set<org.semanticweb.owlapi.model.OWLObject>
select(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, List<String> selectors)
Given an ontology, a set of objects, and a list of selector strings, return the objects related to the set of OWLObjects based on the set of selectors.static Set<org.semanticweb.owlapi.model.OWLObject>
selectAncestors(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all ancestors (recursively) of those objects.static Set<org.semanticweb.owlapi.model.OWLObject>
selectAnnotationProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of annotation properties from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectAnonymous(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of anonymous objects from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectChildren(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return the children of the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectClasses(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLClasses from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectComplement(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all objects contained in the ontology that are NOT in the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectCURIE(IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, String selector)
Given an IOHelper, a set of objects, and a selector string for CURIE pattern, return a set of objects matching that CURIE pattern.static Set<org.semanticweb.owlapi.model.OWLObject>
selectDataProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLDataProperties from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectDescendants(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all descendants (recursively) of those objects.static Set<org.semanticweb.owlapi.model.OWLObject>
selectDomains(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all domains of any properties in the set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectEquivalents(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all equivalent objects of the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectGroups(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, List<List<String>> selectorGroups)
Given an ontology, a set of objects, and a list of select groups (as lists), return the objects related to the set of OWLObjects based on each set of selectors.static Set<org.semanticweb.owlapi.model.OWLObject>
selectIndividuals(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLIndividuals from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectInstances(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, select all the instances of the classes in the set of objects.static Set<org.semanticweb.owlapi.model.OWLObject>
selectIRI(Set<org.semanticweb.owlapi.model.OWLObject> objects, String selector)
Given a set of objects, and a selector string (IRI pattern in angle brackets), select all the objects that have an IRI matching that pattern.static Set<org.semanticweb.owlapi.model.OWLObject>
selectNamed(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of named objects from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectObjectProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLObjectProperties from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectParents(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return the parent objects of all objects in the set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectPattern(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, String annotationPattern)
Given an ontology, a set of objects, and a pattern to match annotations to, return a set of objects that are annotated with the matching annotation.static Set<org.semanticweb.owlapi.model.OWLObject>
selectProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of all OWLProperties from the starting set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectRanges(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all ranges of any properties in the set.static Set<org.semanticweb.owlapi.model.OWLObject>
selectTypes(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return a set of all the types of the individuals in that set.static Set<org.semanticweb.owlapi.model.OWLAxiom>
spanGaps(org.semanticweb.owlapi.model.OWLOntology ontology, List<String> baseNamespaces, Set<org.semanticweb.owlapi.model.OWLObject> objects, boolean excludeAnonymous, boolean internal, boolean external)
Given an ontology and a set of objects, construct a set of subClassOf axioms that span the gaps between classes to maintain a hierarchy.static Set<org.semanticweb.owlapi.model.OWLAxiom>
spanGaps(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, construct a set of subClassOf axioms that span the gaps between classes to maintain a hierarchy.static Set<org.semanticweb.owlapi.model.OWLAxiom>
spanGaps(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, boolean excludeAnonymous)
Given an ontology and a set of objects, construct a set of subClassOf axioms that span the gaps between classes to maintain a hierarchy.
-
-
-
Method Detail
-
getAnnotationAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> getAnnotationAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return the annotation axioms for all objects.- Parameters:
ontology
- OWLOntology to get annotations fromobjects
- OWLObjects to get annotations of- Returns:
- set of OWLAxioms
-
filterAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> filterAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> inputAxioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, List<String> axiomSelectors, List<String> baseNamespaces, boolean partial, boolean namedOnly) throws org.semanticweb.owlapi.model.OWLOntologyCreationException
Filter a set of OWLAxioms based on the provided arguments.- Parameters:
inputAxioms
- Set of OWLAxioms to filterobjects
- Set of OWLObjects to get axioms foraxiomSelectors
- List of string selectors for types of axiomsbaseNamespaces
- List of string base namespaces used for internal/external selectionspartial
- if true, get any axiom containing at least one OWLObject from objectsnamedOnly
- if true, ignore anonymous OWLObjects in axioms- Returns:
- set of filtered OWLAxioms
- Throws:
org.semanticweb.owlapi.model.OWLOntologyCreationException
- on issue creating empty ontology for tautology checker
-
filterAxiomsByAxiomType
public static Set<org.semanticweb.owlapi.model.OWLAxiom> filterAxiomsByAxiomType(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean partial, boolean namedOnly)
Given a set of OWLAxioms, a set of OWLObjects, a set of OWLAxiom Classes, a partial boolean, and a named-only boolean, return a set of OWLAxioms based on OWLAxiom type. The axiom is added to the set if it is an instance of an OWLAxiom Class in the axiomTypes set. If partial, return any axioms that use at least one object from the objects set. Otherwise, only return axioms that use objects in the set. If namedOnly, only consider named OWLObjects in the axioms and ignore any anonymous objects when selecting the axioms.- Parameters:
axioms
- set of OWLAxioms to filterobjects
- set of OWLObjects to get axioms foraxiomTypes
- set of OWLAxiom Classes that determines what type of axioms will be selectedpartial
- if true, include all axioms that use at least one OWLObject from objectsnamedOnly
- if true, ignore anonymous OWLObjects used in axioms- Returns:
- set of filtered axioms
-
filterCompleteAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> filterCompleteAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> inputAxioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given a st of axioms, a set of objects, and a set of axiom types, return a set of axioms where all the objects in those axioms are in the set of objects.- Parameters:
inputAxioms
- Set of OWLAxioms to filterobjects
- Set of objects to match in axiomsaxiomTypes
- OWLAxiom types to returnnamedOnly
- when true, consider only named OWLObjects- Returns:
- Set of OWLAxioms containing only the OWLObjects
-
filterExternalAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> filterExternalAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, List<String> baseNamespaces)
Given a list of base namespaces and a set of axioms, return only the axioms that DO NOT have a subject in the base namespaces.- Parameters:
axioms
- set of OWLAxiomsbaseNamespaces
- list of base namespaces- Returns:
- external OWLAxioms
-
filterInternalAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> filterInternalAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, List<String> baseNamespaces)
Given a list of base namespaces and a set of axioms, return only the axioms that have a subject in the base namespaces.- Parameters:
axioms
- set of OWLAxiomsbaseNamespaces
- list of base namespaces- Returns:
- internal OWLAxioms
-
filterPartialAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> filterPartialAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> inputAxioms, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given a set of axioms, a set of objects, and a set of axiom types, return a set of axioms where at least one object in those axioms is also in the set of objects.- Parameters:
inputAxioms
- Set of OWLAxioms to filterobjects
- Set of OWLObjects to match in axiomsaxiomTypes
- OWLAxiom types to returnnamedOnly
- when true, only consider named OWLObjects- Returns:
- Set of OWLAxioms containing at least one of the OWLObjects
-
filterTautologicalAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> filterTautologicalAxioms(Set<org.semanticweb.owlapi.model.OWLAxiom> axioms, boolean structural) throws org.semanticweb.owlapi.model.OWLOntologyCreationException
Given a set of OWLAxioms and a structural boolean, filter for tautological axioms, i.e., those that would be true in any ontology.- Parameters:
axioms
- set of OWLAxioms to filterstructural
- if true, only filter for structural tautological axioms based on a hard-coded set of patterns (e.g., X subClassOf owl:Thing, owl:Nothing subClassOf X, X subClassOf X)- Returns:
- tautological OWLAxioms from original set
- Throws:
org.semanticweb.owlapi.model.OWLOntologyCreationException
- on issue creating empty ontology for tautology checker
-
getAxioms
@Deprecated public static Set<org.semanticweb.owlapi.model.OWLAxiom> getAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean partial, boolean signature)
Deprecated.- Parameters:
ontology
- OWLOntology to get axioms fromobjects
- OWLObjects to get axioms aboutaxiomTypes
- Set of OWLAxiom Classes that are the types of OWLAxioms to returnpartial
- if true, return any OWLAxiom that has at least one OWLObject from objectssignature
- if true, ignore anonymous OWLObjects in axioms- Returns:
- axioms from ontology based on options
-
getAxiomValues
public static Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> getAxiomValues(String axiomSelector)
Given a string axiom selector, return the OWLAxiom Class type(s) or null. The selector is either a special keyword that represents a set of axiom classes or the name of an OWLAxiom Class.- Parameters:
axiomSelector
- string option to get the OWLAxiom Class type or types for- Returns:
- set of OWLAxiom Class types based on the string option
-
getCompleteAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> getCompleteAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where all the objects in those axioms are in the set of objects. PreferfilterCompleteAxioms(Set, Set, Set, boolean)
.- Parameters:
ontology
- OWLOntology to get axioms fromobjects
- Set of objects to match in axiomsaxiomTypes
- OWLAxiom types to return- Returns:
- Set of OWLAxioms containing only the OWLObjects
-
getCompleteAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> getCompleteAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where all the objects in those axioms are in the set of objects. PreferfilterCompleteAxioms(Set, Set, Set, boolean)
.- Parameters:
ontology
- OWLOntology to get axioms fromobjects
- Set of objects to match in axiomsaxiomTypes
- OWLAxiom types to returnnamedOnly
- when true, consider only named OWLObjects- Returns:
- Set of OWLAxioms containing only the OWLObjects
-
getPartialAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> getPartialAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where at least one object in those axioms is also in the set of objects. PreferfilterPartialAxioms(Set, Set, Set, boolean)
.- Parameters:
ontology
- OWLOntology to get axioms fromobjects
- Set of objects to match in axiomsaxiomTypes
- OWLAxiom types to return- Returns:
- Set of OWLAxioms containing at least one of the OWLObjects
-
getPartialAxioms
public static Set<org.semanticweb.owlapi.model.OWLAxiom> getPartialAxioms(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, Set<Class<? extends org.semanticweb.owlapi.model.OWLAxiom>> axiomTypes, boolean namedOnly)
Given an ontology, a set of objects, and a set of axiom types, return a set of axioms where at least one object in those axioms is also in the set of objects. PreferfilterPartialAxioms(Set, Set, Set, boolean)
.- Parameters:
ontology
- OWLOntology to get axioms fromobjects
- Set of objects to match in axiomsaxiomTypes
- OWLAxiom types to returnnamedOnly
- when true, only consider named OWLObjects- Returns:
- Set of OWLAxioms containing at least one of the OWLObjects
-
selectGroups
public static Set<org.semanticweb.owlapi.model.OWLObject> selectGroups(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, List<List<String>> selectorGroups) throws Exception
Given an ontology, a set of objects, and a list of select groups (as lists), return the objects related to the set of OWLObjects based on each set of selectors. Each selector group will build on the previous group.- Parameters:
ontology
- OWLOntology to get related objects fromioHelper
- IOHelper to use for prefixesobjects
- Set of objects to start withselectorGroups
- types of related objects to return- Returns:
- Set of related objects
- Throws:
Exception
- on annotation pattern issue
-
select
public static Set<org.semanticweb.owlapi.model.OWLObject> select(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, List<String> selectors) throws Exception
Given an ontology, a set of objects, and a list of selector strings, return the objects related to the set of OWLObjects based on the set of selectors.- Parameters:
ontology
- OWLOntology to get related objects fromioHelper
- IOHelper to use for prefixesobjects
- Set of objects to start withselectors
- types of related objects to return- Returns:
- Set of related objects
- Throws:
Exception
- on annotation pattern issue
-
select
public static Set<org.semanticweb.owlapi.model.OWLObject> select(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, String selector) throws Exception
Given an ontology, a set of objects, and a selector, return the related objects related to the set of OWL objects based on the selector.- Parameters:
ontology
- OWLOntology to get related objects fromioHelper
- IOHelper to use for prefixesobjects
- Set of objects to start withselector
- type of related objects to return- Returns:
- Set of related objects
- Throws:
Exception
- on annotation pattern issue
-
selectAncestors
public static Set<org.semanticweb.owlapi.model.OWLObject> selectAncestors(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all ancestors (recursively) of those objects.- Parameters:
ontology
- OWLOntology to retrieve ancestors fromobjects
- OWLObjects to retrieve ancestors of- Returns:
- set of ancestors of the starting set
-
selectAnnotationProperties
public static Set<org.semanticweb.owlapi.model.OWLObject> selectAnnotationProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of annotation properties from the starting set.- Parameters:
objects
- Set of OWLObjects to filter- Returns:
- subset of OWLAnnotationProperties from the starting set
-
selectAnonymous
public static Set<org.semanticweb.owlapi.model.OWLObject> selectAnonymous(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of anonymous objects from the starting set. Valid for classes and individuals.- Parameters:
objects
- Set of OWLObjects to filter- Returns:
- subset of anonymous objects from the starting set
-
selectChildren
public static Set<org.semanticweb.owlapi.model.OWLObject> selectChildren(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return the children of the starting set.- Parameters:
ontology
- OWLOntology to retrieve children fromobjects
- Set of OWLObjects to get children of- Returns:
- set of children of the starting set
-
selectClasses
public static Set<org.semanticweb.owlapi.model.OWLObject> selectClasses(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLClasses from the starting set.- Parameters:
objects
- Set of OWLObjects to filter- Returns:
- subset of OWLClasses from the starting set
-
selectComplement
public static Set<org.semanticweb.owlapi.model.OWLObject> selectComplement(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all objects contained in the ontology that are NOT in the starting set.- Parameters:
ontology
- OWLOntology to retrieve complement objects fromobjects
- Set of OWLObjects to get the complement of- Returns:
- complement set of OWLObjects
-
selectCURIE
public static Set<org.semanticweb.owlapi.model.OWLObject> selectCURIE(IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, String selector)
Given an IOHelper, a set of objects, and a selector string for CURIE pattern, return a set of objects matching that CURIE pattern.- Parameters:
ioHelper
- the IOHelper to resolve namesobjects
- the set of objects to filterselector
- the CURIE selector string- Returns:
- the subset of objects that match the CURIE selector
-
selectDataProperties
public static Set<org.semanticweb.owlapi.model.OWLObject> selectDataProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLDataProperties from the starting set.- Parameters:
objects
- Set of OWLObjects to filter- Returns:
- subset of OWLDataProperties from the starting set
-
selectDescendants
public static Set<org.semanticweb.owlapi.model.OWLObject> selectDescendants(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all descendants (recursively) of those objects.- Parameters:
ontology
- OWLOntology to retrieve descendants fromobjects
- Set of OWLObjects to get descendants of- Returns:
- set of descendants of the starting set
-
selectDomains
public static Set<org.semanticweb.owlapi.model.OWLObject> selectDomains(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all domains of any properties in the set.- Parameters:
ontology
- OWLOntology to retrieve domains fromobjects
- OWLObjects to retrieve domains of- Returns:
- set of domains of the starting set
-
selectEquivalents
public static Set<org.semanticweb.owlapi.model.OWLObject> selectEquivalents(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all equivalent objects of the starting set.- Parameters:
ontology
- OWLOntology to retrieve equivalents fromobjects
- Set of OWLObjects to get equivalents of- Returns:
- set of equivalent OWLObjects
-
selectIndividuals
public static Set<org.semanticweb.owlapi.model.OWLObject> selectIndividuals(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLIndividuals from the starting set.- Parameters:
objects
- Set of OWLObjects to filter- Returns:
- subset of OWLIndividuals from the starting set
-
selectInstances
public static Set<org.semanticweb.owlapi.model.OWLObject> selectInstances(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, select all the instances of the classes in the set of objects.- Parameters:
ontology
- OWLOntology to retrieve instances fromobjects
- Set of OWLObjects to get instances of- Returns:
- set of instances as OWLObjects
-
selectIRI
public static Set<org.semanticweb.owlapi.model.OWLObject> selectIRI(Set<org.semanticweb.owlapi.model.OWLObject> objects, String selector)
Given a set of objects, and a selector string (IRI pattern in angle brackets), select all the objects that have an IRI matching that pattern.- Parameters:
objects
- Set of OWLObjects to look throughselector
- IRI pattern to match (enclosed in angle brackets, using ? or * wildcards)- Returns:
- set of IRIs that match the selector pattern
-
selectNamed
public static Set<org.semanticweb.owlapi.model.OWLObject> selectNamed(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of named objects from the starting set.- Parameters:
objects
- Set of OWLObjects to filter- Returns:
- subset of named objects from the starting set
-
selectObjectProperties
public static Set<org.semanticweb.owlapi.model.OWLObject> selectObjectProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of OWLObjectProperties from the starting set.- Parameters:
objects
- Set of OWLObjects to filter- Returns:
- subset of OWLObjectProperties from the starting set
-
selectParents
public static Set<org.semanticweb.owlapi.model.OWLObject> selectParents(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return the parent objects of all objects in the set.- Parameters:
ontology
- OWLOntology to retrieve parents fromobjects
- set of OWLObjects to get parents of- Returns:
- set of parent objects
-
selectPattern
public static Set<org.semanticweb.owlapi.model.OWLObject> selectPattern(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, Set<org.semanticweb.owlapi.model.OWLObject> objects, String annotationPattern) throws Exception
Given an ontology, a set of objects, and a pattern to match annotations to, return a set of objects that are annotated with the matching annotation.- Parameters:
ontology
- OWLOntology to get annotations fromioHelper
- IOHelper to use for prefixesobjects
- Set of OWLObjects to filterannotationPattern
- annotation to filter OWLObjects on- Returns:
- subset of OWLObjects matching the annotation pattern
- Throws:
Exception
- on issue getting literal annotations
-
selectProperties
public static Set<org.semanticweb.owlapi.model.OWLObject> selectProperties(Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given a set of objects, return a set of all OWLProperties from the starting set.- Parameters:
objects
- Set of OWLObjects to filter OWLProperties of- Returns:
- subset of OWLProperties from the starting set
-
selectRanges
public static Set<org.semanticweb.owlapi.model.OWLObject> selectRanges(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return all ranges of any properties in the set.- Parameters:
ontology
- OWLOntology to retrieve ranges fromobjects
- OWLObjects to retrieve ranges of- Returns:
- set of ranges of the starting set
-
selectTypes
public static Set<org.semanticweb.owlapi.model.OWLObject> selectTypes(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, return a set of all the types of the individuals in that set.- Parameters:
ontology
- OWLOntology to retrieve types fromobjects
- Set of OWLObjects to get the types of- Returns:
- set of types (OWLClass or OWLClassExpression)
-
spanGaps
public static Set<org.semanticweb.owlapi.model.OWLAxiom> spanGaps(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects)
Given an ontology and a set of objects, construct a set of subClassOf axioms that span the gaps between classes to maintain a hierarchy.- Parameters:
ontology
- input OWLOntologyobjects
- set of Objects to build hierarchy- Returns:
- set of OWLAxioms to maintain hierarchy
-
spanGaps
public static Set<org.semanticweb.owlapi.model.OWLAxiom> spanGaps(org.semanticweb.owlapi.model.OWLOntology ontology, Set<org.semanticweb.owlapi.model.OWLObject> objects, boolean excludeAnonymous)
Given an ontology and a set of objects, construct a set of subClassOf axioms that span the gaps between classes to maintain a hierarchy.- Parameters:
ontology
- input OWLOntologyobjects
- set of Objects to build hierarchyexcludeAnonymous
- when true, span across anonymous nodes- Returns:
- set of OWLAxioms to maintain hierarchy
-
spanGaps
public static Set<org.semanticweb.owlapi.model.OWLAxiom> spanGaps(org.semanticweb.owlapi.model.OWLOntology ontology, List<String> baseNamespaces, Set<org.semanticweb.owlapi.model.OWLObject> objects, boolean excludeAnonymous, boolean internal, boolean external)
Given an ontology and a set of objects, construct a set of subClassOf axioms that span the gaps between classes to maintain a hierarchy.- Parameters:
ontology
- input OWLOntologybaseNamespaces
- list of base namespaces as stringsobjects
- set of Objects to build hierarchyexcludeAnonymous
- when true, span across anonymous nodesinternal
- when true, only preserve structure between internal nodes defined by base namespacesexternal
- when true, only preserve structure between external nodes defined by base namespaces- Returns:
- set of OWLAxioms to maintain hierarchy
-
getAnnotations
protected static Set<org.semanticweb.owlapi.model.OWLAnnotation> getAnnotations(org.semanticweb.owlapi.model.OWLOntology ontology, IOHelper ioHelper, String annotation) throws Exception
Given an IOHelper and an annotation as CURIE=..., return the OWLAnnotation object(s).- Parameters:
ontology
- OWLOntology to get annotations fromioHelper
- IOHelper to get IRIannotation
- String input- Returns:
- set of OWLAnnotations
- Throws:
Exception
- on issue getting literal annotation
-
-