protected void expandAssertions(OWLOntology o, OWLAnnotationProperty p) { OWLAnnotationProperty ap425 = df.getOWLAnnotationProperty(IRI_IAO_0000425.getIRI()); getAnnotationObjects(p, o.importsClosure(), ap425).map(a -> a.getValue().asLiteral()) .filter(v -> v.isPresent()) .forEach(v -> { String str = v.get().getLiteral(); LOG.info("assertion mapping {} to {}", p, str); expandAssertionToMap.put(p.getIRI(), str); }); }
protected void expandAssertions(OWLOntology o, OWLAnnotationProperty p) { OWLAnnotationProperty ap425 = df.getOWLAnnotationProperty(IRI_IAO_0000425.getIRI()); getAnnotationObjects(p, o.importsClosure(), ap425).map(a -> a.getValue().asLiteral()) .filter(v -> v.isPresent()) .forEach(v -> { String str = v.get().getLiteral(); LOG.info("assertion mapping {} to {}", p, str); expandAssertionToMap.put(p.getIRI(), str); }); }
protected void expandAssertions(OWLOntology o, OWLAnnotationProperty p) { OWLAnnotationProperty ap425 = df.getOWLAnnotationProperty(IRI_IAO_0000425.getIRI()); getAnnotationObjects(p, o.importsClosure(), ap425).map(a -> a.getValue().asLiteral()) .filter(v -> v.isPresent()) .forEach(v -> { String str = v.get().getLiteral(); LOG.info("assertion mapping {} to {}", p, str); expandAssertionToMap.put(p.getIRI(), str); }); }
/** * Pre process. */ protected void preProcess() { // converse of postProcess in obo2owl String viewRel = null; OWLAnnotationProperty logicalDef = manager.getOWLDataFactory().getOWLAnnotationProperty( Obo2OWLVocabulary.IRI_OIO_LogicalDefinitionViewRelation.getIRI()); List<OWLAnnotation> collect = asList(getOWLOntology().annotations(logicalDef)); for (OWLAnnotation ann : collect) { OWLAnnotationValue v = ann.getValue(); if (v instanceof OWLLiteral) { viewRel = ((OWLLiteral) v).getLiteral(); } else if (v.isIRI()) { viewRel = getIdentifier((IRI) v); } break; } if (viewRel == null) { return; } String view = viewRel; Set<OWLAxiom> rmAxioms = new HashSet<>(); Set<OWLAxiom> newAxioms = new HashSet<>(); getOWLOntology().axioms(AxiomType.EQUIVALENT_CLASSES) .forEach(eca -> preprocessEquivalents(view, rmAxioms, newAxioms, eca)); getOWLOntology().remove(rmAxioms); getOWLOntology().add(newAxioms); }
/** * Pre process. */ protected void preProcess() { // converse of postProcess in obo2owl String viewRel = null; OWLAnnotationProperty logicalDef = manager.getOWLDataFactory().getOWLAnnotationProperty( Obo2OWLVocabulary.IRI_OIO_LogicalDefinitionViewRelation.getIRI()); List<OWLAnnotation> collect = asList(getOWLOntology().annotations(logicalDef)); for (OWLAnnotation ann : collect) { OWLAnnotationValue v = ann.getValue(); if (v instanceof OWLLiteral) { viewRel = ((OWLLiteral) v).getLiteral(); } else if (v.isIRI()) { viewRel = getIdentifier((IRI) v); } break; } if (viewRel == null) { return; } String view = viewRel; Set<OWLAxiom> rmAxioms = new HashSet<>(); Set<OWLAxiom> newAxioms = new HashSet<>(); getOWLOntology().axioms(AxiomType.EQUIVALENT_CLASSES) .forEach(eca -> preprocessEquivalents(view, rmAxioms, newAxioms, eca)); getOWLOntology().remove(rmAxioms); getOWLOntology().add(newAxioms); }
/** * Pre process. */ protected void preProcess() { // converse of postProcess in obo2owl String viewRel = null; OWLAnnotationProperty logicalDef = manager.getOWLDataFactory().getOWLAnnotationProperty( Obo2OWLVocabulary.IRI_OIO_LogicalDefinitionViewRelation.getIRI()); List<OWLAnnotation> collect = asList(getOWLOntology().annotations(logicalDef)); for (OWLAnnotation ann : collect) { OWLAnnotationValue v = ann.getValue(); if (v instanceof OWLLiteral) { viewRel = ((OWLLiteral) v).getLiteral(); } else if (v.isIRI()) { viewRel = getIdentifier((IRI) v); } break; } if (viewRel == null) { return; } String view = viewRel; Set<OWLAxiom> rmAxioms = new HashSet<>(); Set<OWLAxiom> newAxioms = new HashSet<>(); getOWLOntology().axioms(AxiomType.EQUIVALENT_CLASSES) .forEach(eca -> preprocessEquivalents(view, rmAxioms, newAxioms, eca)); getOWLOntology().remove(rmAxioms); getOWLOntology().add(newAxioms); }
/** * Pre process. */ protected void preProcess() { // converse of postProcess in obo2owl String viewRel = null; OWLAnnotationProperty logicalDef = manager.getOWLDataFactory().getOWLAnnotationProperty( Obo2OWLVocabulary.IRI_OIO_LogicalDefinitionViewRelation.getIRI()); List<OWLAnnotation> collect = asList(getOWLOntology().annotations(logicalDef)); for (OWLAnnotation ann : collect) { OWLAnnotationValue v = ann.getValue(); if (v instanceof OWLLiteral) { viewRel = ((OWLLiteral) v).getLiteral(); } else if (v.isIRI()) { viewRel = getIdentifier((IRI) v); } break; } if (viewRel == null) { return; } String view = viewRel; Set<OWLAxiom> rmAxioms = new HashSet<>(); Set<OWLAxiom> newAxioms = new HashSet<>(); getOWLOntology().axioms(AxiomType.EQUIVALENT_CLASSES) .forEach(eca -> preprocessEquivalents(view, rmAxioms, newAxioms, eca)); getOWLOntology().remove(rmAxioms); getOWLOntology().add(newAxioms); }
/** * Table 5.8 Translation of Annotation Vocabulary. * * @return property map */ private static HashMap<String, IRI> initAnnotationPropertyMap() { HashMap<String, IRI> map = new HashMap<String, IRI>(); map.put(OboFormatTag.TAG_IS_OBSELETE.getTag(),OWLRDFVocabulary.OWL_DEPRECATED.getIRI()); map.put(OboFormatTag.TAG_NAME.getTag(),OWLRDFVocabulary.RDFS_LABEL.getIRI()); map.put(OboFormatTag.TAG_COMMENT.getTag(),OWLRDFVocabulary.RDFS_COMMENT.getIRI()); for(Obo2OWLVocabulary vac: Obo2OWLVocabulary.values()){ map.put(vac.getMappedTag(), vac.getIRI()); } /* map.put("expand_expression_to",Obo2OWLVocabulary.IRI_IAO_0000424.getIRI()); map.put("expand_assertion_to",Obo2OWLVocabulary.IRI_IAO_0000425.getIRI()); map.put("def",Obo2OWLVocabulary.IRI_IAO_0000115.getIRI()); map.put("synonym",Obo2OWLVocabulary.IRI_IAO_0000118.getIRI()); map.put("is_anti_symmetric",Obo2OWLVocabulary.IRI_IAO_0000427.getIRI()); map.put("replaced_by", Obo2OWLVocabulary.IRI_IAO_0100001.getIRI());*/ return map; }
/** * Table 5.8 Translation of Annotation Vocabulary. * * @return property map */ protected static Map<String, IRI> initAnnotationPropertyMap() { Map<String, IRI> map = new HashMap<>(); map.put(OboFormatTag.TAG_IS_OBSELETE.getTag(), OWLRDFVocabulary.OWL_DEPRECATED.getIRI()); map.put(OboFormatTag.TAG_NAME.getTag(), OWLRDFVocabulary.RDFS_LABEL.getIRI()); map.put(OboFormatTag.TAG_COMMENT.getTag(), OWLRDFVocabulary.RDFS_COMMENT.getIRI()); for (Obo2OWLVocabulary vac : Obo2OWLVocabulary.values()) { map.put(vac.getMappedTag(), vac.getIRI()); } return map; }
/** * Table 5.8 Translation of Annotation Vocabulary. * * @return property map */ protected static Map<String, IRI> initAnnotationPropertyMap() { Map<String, IRI> map = new HashMap<>(); map.put(OboFormatTag.TAG_IS_OBSELETE.getTag(), OWLRDFVocabulary.OWL_DEPRECATED.getIRI()); map.put(OboFormatTag.TAG_NAME.getTag(), OWLRDFVocabulary.RDFS_LABEL.getIRI()); map.put(OboFormatTag.TAG_COMMENT.getTag(), OWLRDFVocabulary.RDFS_COMMENT.getIRI()); for (Obo2OWLVocabulary vac : Obo2OWLVocabulary.values()) { map.put(vac.getMappedTag(), vac.getIRI()); } return map; }
@SuppressWarnings("null") protected AbstractMacroExpansionVisitor(OWLOntology o) { df = o.getOWLOntologyManager().getOWLDataFactory(); expandExpressionMap = new HashMap<>(); expandAssertionToMap = new HashMap<>(); OWLAnnotationProperty ap424 = df.getOWLAnnotationProperty(IRI_IAO_0000424.getIRI()); o.objectPropertiesInSignature() .forEach(p -> getAnnotationObjects(p, o.importsClosure(), ap424).forEach( a -> mapToExpand(p, a))); o.annotationPropertiesInSignature().forEach(p -> expandAssertions(o, p)); OIO_ISEXPANSION = df.getOWLAnnotationProperty( IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX, "is_expansion")); expansionMarkerAnnotation = df.getOWLAnnotation(OIO_ISEXPANSION, df.getOWLLiteral(true)); }
/** * Table 5.8 Translation of Annotation Vocabulary. * * @return property map */ protected static Map<String, IRI> initAnnotationPropertyMap() { Map<String, IRI> map = new HashMap<>(); map.put(OboFormatTag.TAG_IS_OBSELETE.getTag(), OWLRDFVocabulary.OWL_DEPRECATED.getIRI()); map.put(OboFormatTag.TAG_NAME.getTag(), OWLRDFVocabulary.RDFS_LABEL.getIRI()); map.put(OboFormatTag.TAG_COMMENT.getTag(), OWLRDFVocabulary.RDFS_COMMENT.getIRI()); for (Obo2OWLVocabulary vac : Obo2OWLVocabulary.values()) { map.put(vac.getMappedTag(), vac.getIRI()); } return map; }
@SuppressWarnings("null") protected AbstractMacroExpansionVisitor(OWLOntology o) { df = o.getOWLOntologyManager().getOWLDataFactory(); expandExpressionMap = new HashMap<>(); expandAssertionToMap = new HashMap<>(); OWLAnnotationProperty ap424 = df.getOWLAnnotationProperty(IRI_IAO_0000424.getIRI()); o.objectPropertiesInSignature() .forEach(p -> getAnnotationObjects(p, o.importsClosure(), ap424).forEach( a -> mapToExpand(p, a))); o.annotationPropertiesInSignature().forEach(p -> expandAssertions(o, p)); OIO_ISEXPANSION = df.getOWLAnnotationProperty( IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX, "is_expansion")); expansionMarkerAnnotation = df.getOWLAnnotation(OIO_ISEXPANSION, df.getOWLLiteral(true)); }
@SuppressWarnings("null") protected AbstractMacroExpansionVisitor(OWLOntology o) { df = o.getOWLOntologyManager().getOWLDataFactory(); expandExpressionMap = new HashMap<>(); expandAssertionToMap = new HashMap<>(); OWLAnnotationProperty ap424 = df.getOWLAnnotationProperty(IRI_IAO_0000424.getIRI()); o.objectPropertiesInSignature() .forEach(p -> getAnnotationObjects(p, o.importsClosure(), ap424).forEach( a -> mapToExpand(p, a))); o.annotationPropertiesInSignature().forEach(p -> expandAssertions(o, p)); OIO_ISEXPANSION = df.getOWLAnnotationProperty( IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX, "is_expansion")); expansionMarkerAnnotation = df.getOWLAnnotation(OIO_ISEXPANSION, df.getOWLLiteral(true)); }
@SuppressWarnings("null") protected AbstractMacroExpansionVisitor(OWLOntology o) { df = o.getOWLOntologyManager().getOWLDataFactory(); expandExpressionMap = new HashMap<>(); expandAssertionToMap = new HashMap<>(); OWLAnnotationProperty ap424 = df.getOWLAnnotationProperty(IRI_IAO_0000424.getIRI()); o.objectPropertiesInSignature() .forEach(p -> getAnnotationObjects(p, o.importsClosure(), ap424).forEach( a -> mapToExpand(p, a))); o.annotationPropertiesInSignature().forEach(p -> expandAssertions(o, p)); OIO_ISEXPANSION = df.getOWLAnnotationProperty( IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX, "is_expansion")); expansionMarkerAnnotation = df.getOWLAnnotation(OIO_ISEXPANSION, df.getOWLLiteral(true)); }
/** * Table 5.8 Translation of Annotation Vocabulary. * * @return property map */ protected static Map<String, IRI> initAnnotationPropertyMap() { Map<String, IRI> map = new HashMap<>(); map.put(OboFormatTag.TAG_IS_OBSELETE.getTag(), OWLRDFVocabulary.OWL_DEPRECATED.getIRI()); map.put(OboFormatTag.TAG_NAME.getTag(), OWLRDFVocabulary.RDFS_LABEL.getIRI()); map.put(OboFormatTag.TAG_COMMENT.getTag(), OWLRDFVocabulary.RDFS_COMMENT.getIRI()); for (Obo2OWLVocabulary vac : Obo2OWLVocabulary.values()) { map.put(vac.getMappedTag(), vac.getIRI()); } return map; }
public static IRI getIRI(OBOFormatConstants.OboFormatTag tag) { return Obo2OWLConstants.getVocabularyObj(tag.getTag()).getIRI(); }
protected void expandAssertions(OWLOntology o, OWLAnnotationProperty p) { OWLAnnotationProperty ap425 = df.getOWLAnnotationProperty(IRI_IAO_0000425.getIRI()); getAnnotationObjects(p, o.importsClosure(), ap425).map(a -> a.getValue().asLiteral()) .filter(v -> v.isPresent()) .forEach(v -> { String str = v.get().getLiteral(); LOG.info("assertion mapping {} to {}", p, str); expandAssertionToMap.put(p.getIRI(), str); }); }
private boolean isOBODefinitionProperty(OWLAnnotationProperty property) { IRI propertyIRI = property.getIRI(); IRI defIRI = Obo2OWLConstants.getVocabularyObj(TAG_DEF.getTag()).getIRI(); if (propertyIRI.equals(defIRI)) { return true; } String fragment = propertyIRI.getFragment(); return fragment.endsWith(IAOVocabulary.DEFINITION.getSuffix()); }
private boolean isOBOIRI(IRI iriToCheck, OBOFormatConstants.OboFormatTag tag) { final Obo2OWLConstants.Obo2OWLVocabulary obo2OWLVocab = Obo2OWLConstants.getVocabularyObj(tag.getTag()); return obo2OWLVocab != null && obo2OWLVocab.getIRI().equals(iriToCheck); } }