/** Converts OBO Ids to IRIs. The conversion is defined at <a * href="http://www.obofoundry.org/id-policy.shtml" * >http://www.obofoundry.org/id-policy.shtml</a> * * @param oboId * The Id to convert * @return The IRI of the converted Id */ public static IRI ID2IRI(String oboId) { return ID2IRI(oboId, DEFAULT_ID_SPACE_MANAGER); }
/** @param consumer */ public IDSpaceTagValueHandler(OBOConsumer consumer) { super(OBOVocabulary.ID_SPACE.getName(), consumer); }
private <P extends OWLProperty> OBOTagValuePairList handleCommonTypeDefStanza(P property, OWLOntology ontology, Writer writer) { write("\n[", writer); write(OBOVocabulary.TYPEDEF.getName(), writer); write("]\n", writer); OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getTypeDefStanzaTags()); handleEntityBase(property, ontology, tvpList); Set<OWLClassExpression> domains = property.getDomains(ontology); for (OWLClassExpression domain : domains) { if (!domain.isAnonymous()) { tvpList.addPair(OBOVocabulary.DOMAIN, getID(domain.asOWLClass())); } else { exceptions.add(new OBOStorageException(property, domain, "Anonymous domain that cannot be represented in OBO")); } } final Set<OWLPropertyExpression<?,?>> sp = property.getSuperProperties(ontology); for (OWLPropertyExpression<?,?> superProp : sp) { if (!superProp.isAnonymous()) { tvpList.addPair(OBOVocabulary.IS_A, getID((OWLProperty) superProp)); } else { exceptions.add(new OBOStorageException(property, superProp, "Anonymous property in superProperty is not supported in OBO")); } } tvpList.setDefault(OBOVocabulary.IS_METADATA_TAG, "false"); // annotation properties only return tvpList; }
private void writeInstanceStanza(OWLNamedIndividual individual, OWLOntology ontology, Writer writer) { write("\n[", writer); write(OBOVocabulary.INSTANCE.getName(), writer); write("]\n", writer); OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getInstanceStanzaTags()); if (individual.isAnonymous()) { tvpList.setDefault(OBOVocabulary.IS_ANONYMOUS, "true");
private void writeTermStanza(OWLClass cls, OWLOntology ontology, Writer writer) { write("\n[", writer); write(OBOVocabulary.TERM.getName(), writer); write("]\n", writer); OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getTermStanzaTags());
public void setDefault(OBOVocabulary tag, String value) { defaults.put(tag.getIRI(), value); }
private void writeHeader(OWLOntology ontology, Writer writer) throws OWLRendererException { OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getHeaderTags()); tvpList.setDefault(OBOVocabulary.DEFAULT_NAMESPACE, defaultPrefix); for (OWLAnnotation ax : ontology.getAnnotations()) { if (ax.getProperty().isComment()) { tvpList.addPair(OBOVocabulary.REMARK, ((OWLLiteral) ax.getValue()).getLiteral()); } else { tvpList.visit(ax); } } for (OWLImportsDeclaration importDecl : ontology.getImportsDeclarations()) { tvpList.addPair(OBOVocabulary.IMPORT, importDecl.getIRI().toString()); } Map<String, String> namespace2PrefixMap = loadUsedNamespaces(ontology); for (String namespace : namespace2PrefixMap.keySet()) { String mapping = namespace2PrefixMap.get(namespace) + " " + namespace; tvpList.addPair(OBOVocabulary.ID_SPACE, mapping); } // overwrite the existing values for below tvpList.setPair(OBOVocabulary.FORMAT_VERSION, "1.2"); tvpList.setPair(OBOVocabulary.DATE, getTimestampFormatter().format(new Date(System.currentTimeMillis()))); tvpList.setPair(OBOVocabulary.SAVED_BY, System.getProperty("user.name")); tvpList.setPair(OBOVocabulary.AUTO_GENERATED_BY, VersionInfo.getVersionInfo().toString()); tvpList.write(writer); }
/** @param consumer */ public IsObsoleteTagValueHandler(OBOConsumer consumer) { super(OBOVocabulary.IS_OBSOLETE.getName(), consumer); }
private <P extends OWLProperty> OBOTagValuePairList handleCommonTypeDefStanza(P property, OWLOntology ontology, Writer writer) { write("\n[", writer); write(OBOVocabulary.TYPEDEF.getName(), writer); write("]\n", writer); OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getTypeDefStanzaTags()); handleEntityBase(property, ontology, tvpList); Set<OWLClassExpression> domains = property.getDomains(ontology); for (OWLClassExpression domain : domains) { if (!domain.isAnonymous()) { tvpList.addPair(OBOVocabulary.DOMAIN, getID(domain.asOWLClass())); } else { exceptions.add(new OBOStorageException(property, domain, "Anonymous domain that cannot be represented in OBO")); } } final Set<OWLPropertyExpression<?,?>> sp = property.getSuperProperties(ontology); for (OWLPropertyExpression<?,?> superProp : sp) { if (!superProp.isAnonymous()) { tvpList.addPair(OBOVocabulary.IS_A, getID((OWLProperty) superProp)); } else { exceptions.add(new OBOStorageException(property, superProp, "Anonymous property in superProperty is not supported in OBO")); } } tvpList.setDefault(OBOVocabulary.IS_METADATA_TAG, "false"); // annotation properties only return tvpList; }
private void writeInstanceStanza(OWLNamedIndividual individual, OWLOntology ontology, Writer writer) { write("\n[", writer); write(OBOVocabulary.INSTANCE.getName(), writer); write("]\n", writer); OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getInstanceStanzaTags()); if (individual.isAnonymous()) { tvpList.setDefault(OBOVocabulary.IS_ANONYMOUS, "true");
private void writeTermStanza(OWLClass cls, OWLOntology ontology, Writer writer) { write("\n[", writer); write(OBOVocabulary.TERM.getName(), writer); write("]\n", writer); OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getTermStanzaTags());
public void setDefault(OBOVocabulary tag, String value) { defaults.put(tag.getIRI(), value); }
private void writeHeader(OWLOntology ontology, Writer writer) throws OWLRendererException { OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getHeaderTags()); tvpList.setDefault(OBOVocabulary.DEFAULT_NAMESPACE, defaultPrefix); for (OWLAnnotation ax : ontology.getAnnotations()) { if (ax.getProperty().isComment()) { tvpList.addPair(OBOVocabulary.REMARK, ((OWLLiteral) ax.getValue()).getLiteral()); } else { tvpList.visit(ax); } } for (OWLImportsDeclaration importDecl : ontology.getImportsDeclarations()) { tvpList.addPair(OBOVocabulary.IMPORT, importDecl.getIRI().toString()); } Map<String, String> namespace2PrefixMap = loadUsedNamespaces(ontology); for (String namespace : namespace2PrefixMap.keySet()) { String mapping = namespace2PrefixMap.get(namespace) + " " + namespace; tvpList.addPair(OBOVocabulary.ID_SPACE, mapping); } // overwrite the existing values for below tvpList.setPair(OBOVocabulary.FORMAT_VERSION, "1.2"); tvpList.setPair(OBOVocabulary.DATE, getTimestampFormatter().format(new Date(System.currentTimeMillis()))); tvpList.setPair(OBOVocabulary.SAVED_BY, System.getProperty("user.name")); tvpList.setPair(OBOVocabulary.AUTO_GENERATED_BY, VersionInfo.getVersionInfo().toString()); tvpList.write(writer); }
/** @param consumer */ public SynonymTypeDefTagHandler(OBOConsumer consumer) { super(OBOVocabulary.SYNONYM_TYPE_DEF.getName(), consumer); }
private <P extends OWLProperty> OBOTagValuePairList handleCommonTypeDefStanza(P property, OWLOntology ontology, Writer writer) { write("\n[", writer); write(OBOVocabulary.TYPEDEF.getName(), writer); write("]\n", writer); OBOTagValuePairList tvpList = new OBOTagValuePairList(OBOVocabulary.getTypeDefStanzaTags()); handleEntityBase(property, ontology, tvpList); Set<OWLClassExpression> domains = property.getDomains(ontology); for (OWLClassExpression domain : domains) { if (!domain.isAnonymous()) { tvpList.addPair(OBOVocabulary.DOMAIN, getID(domain.asOWLClass())); } else { exceptions.add(new OBOStorageException(property, domain, "Anonymous domain that cannot be represented in OBO")); } } final Set<OWLPropertyExpression> sp = property.getSuperProperties(ontology); for (OWLPropertyExpression superProp : sp) { if (!superProp.isAnonymous()) { tvpList.addPair(OBOVocabulary.IS_A, getID((OWLProperty) superProp)); } else { exceptions.add(new OBOStorageException(property, superProp, "Anonymous property in superProperty is not supported in OBO")); } } tvpList.setDefault(OBOVocabulary.IS_METADATA_TAG, "false"); // annotation properties only return tvpList; }