Package org.incenp.obofoundry.sssom.owl
Class XrefExtractor
- java.lang.Object
-
- org.incenp.obofoundry.sssom.owl.XrefExtractor
-
public class XrefExtractor extends Object
Extract mappings from cross-references (oboInOwl:hasDbXref annotations) in a ontology.
-
-
Constructor Summary
Constructors Constructor Description XrefExtractor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPrefixToPredicateMapping(String prefixName, String predicate)Maps a prefix name to a predicate.MappingSetextract(org.semanticweb.owlapi.model.OWLOntology ontology)Extract mappings from cross-references in the specified ontology.MappingSetextract(org.semanticweb.owlapi.model.OWLOntology ontology, boolean permissive, boolean includeGeneric)Extract mappings from cross-references in the specified ontology.voidfillPrefixToPredicateMap(org.semanticweb.owlapi.model.OWLOntology ontology)Gets the mappings between prefix names and predicates from annotations in the given ontology.Set<String>getUnknownPrefixNames()Gets any prefix names encountered in cross-references that could not be resolved.voidincludeObsoletes(boolean value)Indicates whether cross-references on obsoleted terms should be extracted.voidsetPrefixMap(Map<String,String> map)Sets the prefix map to be used when processing cross-reference annotations.
-
-
-
Method Detail
-
setPrefixMap
public void setPrefixMap(Map<String,String> map)
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
public void addPrefixToPredicateMapping(String prefixName, String predicate)
Maps a prefix name to a predicate. By default, mappings derived from cross-references have aoboInOwl:hasDbXrefpredicate. 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:exactMatchpredicate;oboInOwl#treat-xrefs-as-is_a: map a prefix name to theskos:broadMatchpredicate;oboInOwl#treat-xrefs-as-has-subclass: map a prefix name to theskos:narrowMatchpredicate;oboInOwl#treat-xrefs-as-genus-differentia: map a prefix name to thesemapv:crossSpeciesExactMatchpredicate;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-trueto extract cross-references on obsoleted terms.
-
extract
public MappingSet extract(org.semanticweb.owlapi.model.OWLOntology ontology)
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:hasDbXrefpredicate.- Returns:
- The set of mappings extracted from the ontology.
-
-