private void error(String message, OWLAxiom ax) { untranslatableAxioms.add(ax); error(message + ax); }
private void error(OWLAxiom ax) { untranslatableAxioms.add(ax); error("the axiom is not translated : " + ax); }
public String getIdentifier(OWLObject obj) { try { return getIdentifierFromObject(obj, owlOntology); } catch (UntranslatableAxiomException e) { error(e.getMessage()); } return null; }
private void tr(OWLAsymmetricObjectPropertyAxiom ax){ OWLObjectPropertyExpression prop = ax.getProperty(); if(prop instanceof OWLObjectProperty){ if( trObjectProperty((OWLObjectProperty)prop, OboFormatTag.TAG_IS_ASYMMETRIC.getTag(), Boolean.TRUE, ax.getAnnotations()) ){ return; } } error(ax); }
private void tr(OWLFunctionalObjectPropertyAxiom ax){ OWLObjectPropertyExpression prop = ax.getProperty(); if(prop instanceof OWLObjectProperty){ if( trObjectProperty((OWLObjectProperty)prop, OboFormatTag.TAG_IS_FUNCTIONAL.getTag(), Boolean.TRUE, ax.getAnnotations()) ) { return; } } error(ax); }
private void trNaryPropertyAxiom(OWLNaryPropertyAxiom<OWLObjectPropertyExpression> ax, String tag){ Set<OWLObjectPropertyExpression> set = ax.getProperties(); if(set.size()>1){ boolean first = true; OWLObjectProperty prop = null; String disjointFrom = null; for(OWLObjectPropertyExpression ex: set){ if (ex.isBottomEntity() || ex.isTopEntity()) { error(tag+" using Top or Bottom entities are not supported in OBO.", ax); return; } if(first){ first = false; if(ex instanceof OWLObjectProperty) { prop = (OWLObjectProperty)ex; } }else{ disjointFrom = this.getIdentifier(ex); //getIdentifier(ex); } } if( trObjectProperty(prop, tag, disjointFrom, ax.getAnnotations()) ){ return; } } error(ax); }
private void tr(OWLTransitiveObjectPropertyAxiom ax){ OWLObjectPropertyExpression prop = ax.getProperty(); if(prop instanceof OWLObjectProperty){ if( trObjectProperty((OWLObjectProperty)prop, OboFormatTag.TAG_IS_TRANSITIVE.getTag(), Boolean.TRUE, ax.getAnnotations()) ) { return; } } error(ax); }
private void tr(OWLReflexiveObjectPropertyAxiom ax){ OWLObjectPropertyExpression prop = ax.getProperty(); if(prop instanceof OWLObjectProperty){ if( trObjectProperty((OWLObjectProperty)prop, OboFormatTag.TAG_IS_REFLEXIVE.getTag(), Boolean.TRUE, ax.getAnnotations()) ) { return; } } error(ax); }
private void tr(OWLSymmetricObjectPropertyAxiom ax){ OWLObjectPropertyExpression prop = ax.getProperty(); if(prop instanceof OWLObjectProperty){ if( trObjectProperty((OWLObjectProperty)prop, OboFormatTag.TAG_IS_SYMMETRIC.getTag(), Boolean.TRUE, ax.getAnnotations()) ) { return; } } error(ax); }
private void tr(OWLInverseFunctionalObjectPropertyAxiom ax){ OWLObjectPropertyExpression prop = ax.getProperty(); if(prop instanceof OWLObjectProperty){ if( trObjectProperty((OWLObjectProperty)prop, OboFormatTag.TAG_IS_INVERSE_FUNCTIONAL.getTag(), Boolean.TRUE, ax.getAnnotations()) ) { return; } } error(ax); } private void tr(OWLInverseObjectPropertiesAxiom ax){
private void tr(OWLDisjointClassesAxiom ax) { // use set, the OWL-API does not provide an order Set<OWLClassExpression> set = ax.getClassExpressions(); if (set.size() != 2) { error("Expected two classes in a disjoin classes axiom.", ax); } Iterator<OWLClassExpression> it = set.iterator(); OWLClassExpression ce1 = it.next(); OWLClassExpression ce2 = it.next(); if (ce1.isBottomEntity() || ce1.isTopEntity() || ce2.isBottomEntity() || ce2.isTopEntity()) { error("Disjoint classes axiom using Top or Bottom entities are not supported.", ax); } String cls2 = this.getIdentifier(ce2); if(cls2 == null){ error(ax); return; } if (ce1.isAnonymous()) { error(ax); return; } OWLClass cls1 = ce1.asOWLClass(); Frame f = getTermFrame(cls1); Clause c = new Clause(); c.setTag(OboFormatTag.TAG_DISJOINT_FROM.getTag()); c.setValue(cls2); f.addClause(c); addQualifiers(c, ax.getAnnotations()); }
private void tr(OWLObjectPropertyDomainAxiom ax){ final OWLClassExpression domain = ax.getDomain(); OWLObjectPropertyExpression propEx = ax.getProperty(); if (propEx.isAnonymous()) { error(ax); return; } OWLObjectProperty prop = propEx.asOWLObjectProperty(); if (domain.isBottomEntity() || domain.isTopEntity()) { // at least get the type def frame getTypedefFrame(prop); // now throw the error error("domains using top or bottom entities are not translatable to OBO.", ax); return; } String range = this.getIdentifier(domain); if(range != null){ if( trObjectProperty(prop, OboFormatTag.TAG_DOMAIN.getTag(), range, ax.getAnnotations()) ){ return; } } error(ax); }
private void tr(OWLObjectPropertyRangeAxiom ax){ final OWLClassExpression owlRange = ax.getRange(); OWLObjectPropertyExpression propEx = ax.getProperty(); if (propEx.isAnonymous()) { error(ax); } OWLObjectProperty prop = propEx.asOWLObjectProperty(); if (owlRange.isBottomEntity() || owlRange.isTopEntity()) { // at least create the property frame getTypedefFrame(prop); // error message error("ranges using top or bottom entities are not translatable to OBO.", ax); return; } String range = this.getIdentifier(owlRange); //getIdentifier(ax.getRange()); if(range != null){ if( trObjectProperty(prop, OboFormatTag.TAG_RANGE.getTag(), range, ax.getAnnotations()) ) { return; } } error(ax); }
private void tr(OWLInverseObjectPropertiesAxiom ax){ OWLObjectPropertyExpression prop1 = ax.getFirstProperty(); OWLObjectPropertyExpression prop2 = ax.getSecondProperty(); if(prop1 instanceof OWLObjectProperty && prop2 instanceof OWLObjectProperty){ if( trObjectProperty((OWLObjectProperty)prop1, OboFormatTag.TAG_INVERSE_OF.getTag(), this.getIdentifier(prop2), ax.getAnnotations()) ) { return; } } error(ax); }
private void tr(OWLSubObjectPropertyOfAxiom ax){ OWLObjectPropertyExpression sup = ax.getSuperProperty(); OWLObjectPropertyExpression sub = ax.getSubProperty(); if (sub.isBottomEntity() || sub.isTopEntity() || sup.isBottomEntity() || sub.isTopEntity()) { error("SubProperties using Top or Bottom entites are not supported in OBO."); return; } if(sub instanceof OWLObjectProperty && sup instanceof OWLObjectProperty){ String supId = this.getIdentifier(sup); if(supId.startsWith("owl:")){ return; } Frame f = getTypedefFrame((OWLObjectProperty) sub); Clause clause = new Clause(OboFormatTag.TAG_IS_A, supId); f.addClause(clause); addQualifiers(clause, ax.getAnnotations()); }else{ error(ax); } }
if (tag == OboFormatTag.TAG_ID) { if (frame.getId().equals(value) == false) { error("Conflicting id definitions: 1) "+frame.getId()+" 2)"+value); return false; clause.addValue(OBOFormatConstants.headerDateFormat.get().parseObject(value)); } catch (ParseException e) { error("Could not parse date string: "+value); return false;
IRI dataTypeIri = datatype.getIRI(); if (!OWL2Datatype.isBuiltIn(dataTypeIri)) { error("Untranslatable axiom due to unknown data type: "+annVal); return false;
}else{ if(!(ax instanceof OWLAnnotationAssertionAxiom)){ error(ax);