/** * See table 5.9.2. Translation of identifiers * * @param iriId * @return obo identifier or null */ public static String getIdentifier(IRI iriId) { return getIdentifier(iriId, null); }
return getIdentifier(((OWLEntity)obj).getIRI(), ont); return getIdentifier((IRI)obj, ont);
if (this.getIdentifier(p).equals(viewRel) == false) { LOG.log(Level.SEVERE, "Expected: " + viewRel + " got: " + p + " in " + eca);
private String getIdentifierUsingBaseOntology(IRI iriId) { return getIdentifier(iriId, owlOntology); }
String propId = this.getIdentifier(prop); addQualifiers(clause, qualifiers); if (propId.equals("shorthand") == false) {
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 Frame getTypedefFrame(OWLEntity entity){ String id = this.getIdentifier(entity); Frame f = obodoc.getTypedefFrame(id); if (f == null) { f = new Frame(FrameType.TYPEDEF); f.setId(id); f.addClause(new Clause(OboFormatTag.TAG_ID, id)); add(f); } return f; }
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 handleSynonym(Set<OWLAnnotation> qualifiers, String scope, Clause clause, Set<OWLAnnotation> unprocessedQualifiers) { clause.setTag(OboFormatTag.TAG_SYNONYM.getTag()); String type = null; clause.setXrefs(new Vector<Xref>()); for(OWLAnnotation aan: qualifiers){ String propId = owlObjectToTag(aan.getProperty()); if(OboFormatTag.TAG_XREF.getTag().equals(propId)){ String xrefValue = ((OWLLiteral) aan.getValue()).getLiteral(); Xref xref = new Xref(xrefValue); clause.addXref(xref); unprocessedQualifiers.remove(aan); }else if(OboFormatTag.TAG_HAS_SYNONYM_TYPE.getTag().equals(propId)){ type = getIdentifier(aan.getValue()); unprocessedQualifiers.remove(aan); } } if(scope != null){ clause.addValue(scope); if(type != null){ clause.addValue(type); } } }
String cls2 = this.getIdentifier(ce2); if (cls2 != null) { Clause c = new Clause(); String id = this.getIdentifier(oce); Clause c = new Clause(); c.setTag(OboFormatTag.TAG_UNION_OF.getTag()); cls2 = this.getIdentifier(ce); r = this.getIdentifier(ristriction.getProperty()); cls2 = this.getIdentifier(ristriction.getFiller()); r = this.getIdentifier(card.getProperty()); cls2 = this.getIdentifier(card.getFiller()); exact = card.getCardinality(); r = this.getIdentifier(card.getProperty()); cls2 = this.getIdentifier(card.getFiller()); min = card.getCardinality(); r = this.getIdentifier(card.getProperty()); cls2 = this.getIdentifier(card.getFiller()); max = card.getCardinality(); final OWLClassExpression filler = all.getFiller(); if (filler instanceof OWLClass) { r = this.getIdentifier(all.getProperty()); cls2 = this.getIdentifier(filler);
private Clause createRelationshipClauseWithRestrictions( OWLQuantifiedObjectRestriction r, String fillerId, Set<QualifierValue> qvs, OWLSubClassOfAxiom ax) { Clause c = new Clause(); c.setTag(OboFormatTag.TAG_RELATIONSHIP.getTag()); c.addValue(this.getIdentifier(r.getProperty())); c.addValue(fillerId); c.setQualifierValues(qvs); addQualifiers(c, ax.getAnnotations()); return c; }
String rel1 = getIdentifier(exp1); String rel2 = getIdentifier(exp2);
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(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); } }
private Clause createRelationshipClauseWithCardinality( OWLObjectCardinalityRestriction restriction, String fillerId, Set<QualifierValue> qvs, OWLSubClassOfAxiom ax) { Clause c = new Clause(); c.setTag(OboFormatTag.TAG_RELATIONSHIP.getTag()); c.addValue(this.getIdentifier(restriction.getProperty())); c.addValue(fillerId); c.setQualifierValues(qvs); String q = "cardinality"; if (restriction instanceof OWLObjectMinCardinality) { q = "minCardinality"; } else if (restriction instanceof OWLObjectMaxCardinality) { q = "maxCardinality"; } c.addQualifierValue(new QualifierValue(q, Integer.toString(restriction.getCardinality()))); addQualifiers(c, ax.getAnnotations()); return c; }
OWLAnnotationProperty subProperty = axiom.getSubProperty(); if (prop.equals(subProperty)) { synonymType = getIdentifier(prop.getIRI()); tagString = OboFormatTag.TAG_SYNONYM.getTag(); break; if(tag == null){ Clause clause = new Clause(OboFormatTag.TAG_PROPERTY_VALUE); String propId = this.getIdentifier(prop); addQualifiers(clause, qualifiers); if (propId.equals("shorthand") == false) {
qvs.add(new QualifierValue("gci_relation",getIdentifier(p))); qvs.add(new QualifierValue("gci_filler",getIdentifier(filler))); Clause c = new Clause(); c.setTag(OboFormatTag.TAG_IS_A.getTag()); c.setValue(this.getIdentifier(sup)); c.setQualifierValues(qvs); f.addClause(c); return; String fillerId = this.getIdentifier(filler); return; String fillerId = this.getIdentifier(filler); if(fillerId == null){ error(ax); return; String fillerId = this.getIdentifier(filler); if(fillerId == null){ error(ax); String fillerId = this.getIdentifier(filler); if(fillerId == null){ error(ax);
clause.addValue(this.getIdentifier(sub)); clause.addValue(name); if (scope != null) { clause.addValue(this.getIdentifier(sub)); clause.addValue(comment); if (!hf.getClauses().contains(clause)) { String supId = this.getIdentifier(sup); //getIdentifier(sup);
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); }