Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for prefix declarations in OBO format #1102

Open
wants to merge 18 commits into
base: version4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Informatics Group
* @since 2.0.0
*/
public class OBODocumentFormat extends OWLDocumentFormatImpl {
public class OBODocumentFormat extends PrefixDocumentFormatImpl {

/**
* Key for validation parameter. Currently supports Boolean.TRUE and
Expand All @@ -36,14 +36,4 @@ public String getKey() {
return "OBO Format";
}

@Override
public boolean isPrefixOWLOntologyFormat() {
return false;
}

@Override
public PrefixDocumentFormat asPrefixOWLOntologyFormat() {
throw new UnsupportedOperationException(getClass().getName()
+ " is not a PrefixDocumentFormat");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ public void setObodoc(OBODoc obodoc) {
this.obodoc = obodoc;
}

public Map<String, String> getIdSpaceMap() {
return Collections.unmodifiableMap(this.idSpaceMap);
}

/**
* Gets the owl ontology.
*
Expand Down Expand Up @@ -548,7 +552,12 @@ public void trHeaderFrame(@Nonnull Frame headerFrame) {
trAnnotations(clause));
}
} else if (tag == OboFormatTag.TAG_IDSPACE) {
// do not translate, as they are just directives? TODO ask Chris
for (Clause clause : headerFrame.getClauses(t)) {
Object[] values = clause.getValues().toArray();
String prefix = values[0].toString();
String baseurl = values[1].toString();
idSpaceMap.put(prefix, baseurl);
}
} else if (tag == OboFormatTag.TAG_OWL_AXIOMS) {
// in theory, there should only be one tag
// but we can silently collapse multiple tags
Expand Down Expand Up @@ -1244,6 +1253,12 @@ protected OWLAxiom trGenericClause(@Nonnull OWLAnnotationSubject sub, @Nonnull S
}
ax = fac.getOWLAnnotationAssertionAxiom(trTagToAnnotationProp(tag), sub,
trLiteral(clause.getValue()), annotations);
} else if (tagConstant == OboFormatTag.TAG_REPLACED_BY
|| tagConstant == OboFormatTag.TAG_CONSIDER) {
String curie = (String) clause.getValue();
IRI iri = oboIdToIRI(curie);
ax = fac.getOWLAnnotationAssertionAxiom(trTagToAnnotationProp(tag), sub,
iri, annotations);
} else {
// generic
// System.out.println("generic clause:"+clause);
Expand Down
Loading