trTagToAnnotationProp(values[2].toString())
.getIRI()));
}
}
} else if (tag == OboFormatTag.TAG_DATE) {
Clause clause = headerFrame.getClause(tag);
Object value = clause.getValue();
String dateString = null;
if (value instanceof Date) {
dateString = OBOFormatConstants.headerDateFormat().format(
(Date) value);
} else if (value instanceof String) {
dateString = (String) value;
}
if (dateString != null) {
addOntologyAnnotation(trTagToAnnotationProp(t),
trLiteral(dateString), trAnnotations(clause));
} else {
// TODO: Throw Exceptions
OBOFormatException e = new OBOFormatException(
"Cannot translate clause «" + clause + '»');
LOG.error("Cannot translate: {}", clause, e);
}
} else if (tag == OboFormatTag.TAG_PROPERTY_VALUE) {
addPropertyValueHeaders(headerFrame
.getClauses(OboFormatTag.TAG_PROPERTY_VALUE));
} else if (tag == OboFormatTag.TAG_DATA_VERSION) {
/*
* Clause clause = headerFrame.getClause(tag); String dv =
* clause.getValue().toString(); String ontOboId =
* headerFrame.getClause
* (OboFormatTag.TAG_ONTOLOGY).getValue().toString(); IRI vIRI =
* IRI
* .create(Obo2OWLConstants.DEFAULT_IRI_PREFIX+ontOboId+"/"+dv
* +"/"+ontOboId+".owl");
* System.out.println("Adding versionIRI "+vIRI);
* addOntologyAnnotation(fac.getOWLVersionInfo(),
* fac.getOWLLiteral(vIRI.toString(),
* OWL2Datatype.XSD_ANY_URI));
*/
} else if (tag == OboFormatTag.TAG_REMARK) {
// translate remark as rdfs:comment
Collection<Clause> clauses = headerFrame.getClauses(t);
for (Clause clause : clauses) {
addOntologyAnnotation(fac.getRDFSComment(),
trLiteral(clause.getValue()), trAnnotations(clause));
}
} else if (tag == OboFormatTag.TAG_IDSPACE) {
// do not translate, as they are just directives? TODO ask Chris
} else if (tag == OboFormatTag.TAG_OWL_AXIOMS) {
// in theory, there should only be one tag
// but we can silently collapse multiple tags
Collection<String> axiomStrings = headerFrame.getTagValues(tag,
String.class);
try {
for (String axiomString : axiomStrings) {
Set<OWLAxiom> axioms = OwlStringTools.translate(
axiomString, manager);
if (axioms != null) {
manager.addAxioms(getOwlOntology(), axioms);
}
}
} catch (OwlStringException e) {
throw new RuntimeException(e);
}
} else {
Collection<Clause> clauses = headerFrame.getClauses(t);
for (Clause clause : clauses) {
addOntologyAnnotation(trTagToAnnotationProp(t),
trLiteral(clause.getValue()), trAnnotations(clause));
}
}
}
}