Package org.incenp.obofoundry.sssom.owl
Class XrefExtractor
java.lang.Object
org.incenp.obofoundry.sssom.owl.XrefExtractor
Extract mappings from cross-references (oboInOwl:hasDbXref annotations) in a
ontology.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPrefixToPredicateMapping
(String prefixName, String predicate) Maps a prefix name to a predicate.extract
(org.semanticweb.owlapi.model.OWLOntology ontology) Extract mappings from cross-references in the specified ontology.extract
(org.semanticweb.owlapi.model.OWLOntology ontology, boolean permissive, boolean includeGeneric) Extract mappings from cross-references in the specified ontology.void
fillPrefixToPredicateMap
(org.semanticweb.owlapi.model.OWLOntology ontology) Gets the mappings between prefix names and predicates from annotations in the given ontology.Gets any prefix names encountered in cross-references that could not be resolved.void
includeObsoletes
(boolean value) Indicates whether cross-references on obsoleted terms should be extracted.void
setPrefixMap
(Map<String, String> map) Sets the prefix map to be used when processing cross-reference annotations.
-
Constructor Details
-
XrefExtractor
public XrefExtractor()
-
-
Method Details
-
setPrefixMap
Sets the prefix map to be used when processing cross-reference annotations. By default, only cross-references using a known prefix name will be derived into mappings.- Parameters:
map
- A map of prefix names to URL prefixes.
-
addPrefixToPredicateMapping
Maps a prefix name to a predicate. By default, mappings derived from cross-references have aoboInOwl:hasDbXref
predicate. Use this method to force the use of another predicate for cross-references that use a specific prefix name.- Parameters:
prefixName
- The prefix name, as used in cross-references.predicate
- The mapping predicate to use.
-
fillPrefixToPredicateMap
public void fillPrefixToPredicateMap(org.semanticweb.owlapi.model.OWLOntology ontology) Gets the mappings between prefix names and predicates from annotations in the given ontology.This method recognises the following annotations:
oboInOwl#treat-xrefs-as-equivalent
: map a prefix name to theskos:exactMatch
predicate;oboInOwl#treat-xrefs-as-is_a
: map a prefix name to theskos:broadMatch
predicate;oboInOwl#treat-xrefs-as-has-subclass
: map a prefix name to theskos:narrowMatch
predicate;oboInOwl#treat-xrefs-as-genus-differentia
: map a prefix name to thesemapv:crossSpeciesExactMatch
predicate;oboInOwl#treat-xrefs-as-reverse-genus-differentia
: likewise.
- Parameters:
ontology
- The ontology to extract the prefix-to-predicate mappings from.
-
includeObsoletes
public void includeObsoletes(boolean value) Indicates whether cross-references on obsoleted terms should be extracted. The default behaviour is to ignore obsoleted terms.- Parameters:
value
-true
to extract cross-references on obsoleted terms.
-
extract
Extract mappings from cross-references in the specified ontology. Only cross-references with prefixes that are (1) known, and (2) associated with a predicate (through eitheraddPrefixToPredicateMapping(String, String)
orfillPrefixToPredicateMap(OWLOntology)
) are taken into account.- Parameters:
ontology
- The ontology to extract mappings from.- Returns:
- The set of mappings extracted from the ontology.
-
extract
public MappingSet extract(org.semanticweb.owlapi.model.OWLOntology ontology, boolean permissive, boolean includeGeneric) Extract mappings from cross-references in the specified ontology.- Parameters:
ontology
- The ontology to extract mappings from.permissive
- Iftrue
, cross-references using an non-resolvable prefix name will not be ignored.includeGeneric
- Iftrue
, cross-references using a prefix name that has not been associated to a mapping predicate will not be ignored, and will yield mappings with theoboInOwl:hasDbXref
predicate.- Returns:
- The set of mappings extracted from the ontology.
-
getUnknownPrefixNames
Gets any prefix names encountered in cross-references that could not be resolved.- Returns:
- The list of unknown prefix names.
-