Java Code Examples for org.obolibrary.oboformat.model.OBODoc#getTermFrame()
The following examples show how to use
org.obolibrary.oboformat.model.OBODoc#getTermFrame() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CardinalityCheckAndRepairMooncatTest.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test and repair cardinalities of DEF and COMMENT tags after merging * ontologies (B contains MIREOTed terms from C) via {@link Mooncat}. * * @throws Exception */ @Test public void testMireot() throws Exception { ParserWrapper pw = new ParserWrapper(); OWLGraphWrapper g = pw.parseToOWLGraph(getResourceIRIString("mooncat/A.obo")); Mooncat m = new Mooncat(g); m.addReferencedOntology(pw.parseOBO(getResourceIRIString("mooncat/B.obo"))); m.addReferencedOntology(pw.parseOBO(getResourceIRIString("mooncat/C.obo"))); m.mergeOntologies(); OWLOntology sourceOntology = g.getSourceOntology(); OboInOwlCardinalityTools.checkAnnotationCardinality(sourceOntology); Owl2Obo owl2Obo = new Owl2Obo(); OBODoc oboDoc = owl2Obo.convert(sourceOntology); if (RENDER_ONTOLOGY_FLAG) { renderOBO(oboDoc); } Frame termFrame = oboDoc.getTermFrame("C:0000001"); Collection<Clause> defClauses = termFrame.getClauses(OboFormatTag.TAG_DEF); assertEquals(1, defClauses.size()); Collection<Clause> commentClauses = termFrame.getClauses(OboFormatTag.TAG_COMMENT); assertEquals(1, commentClauses.size()); }
Example 2
Source File: CardinalityContraintsToolsTest.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void assertNoQualifiers(String id, OBODoc obo) { Frame frame = obo.getTermFrame(id); Collection<Clause> clauses = frame.getClauses(OboFormatTag.TAG_INTERSECTION_OF); final String message = "Expected intersection clauses for id: "+id; assertNotNull(message, clauses); assertEquals(message, 2, clauses.size()); for (Clause clause : clauses) { Collection<QualifierValue> qualifierValues = clause.getQualifierValues(); if (qualifierValues != null && !qualifierValues.isEmpty()) { fail("No qualifiers expected, but was: "+frame); } } }
Example 3
Source File: RemoveDirectivesTest.java From owltools with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Test public void testRemove() throws Exception { ParserWrapper pw = new ParserWrapper(); OWLGraphWrapper g = pw.parseToOWLGraph(getResourceIRIString("mooncat/remove-directives-test1.obo")); System.out.println(g.getSourceOntology().getAxioms(AxiomType.EQUIVALENT_CLASSES)); OWLOntology secondary = pw.parse(getResourceIRIString("mooncat/remove-directives-test2.obo")); System.out.println(secondary.getAxioms(AxiomType.EQUIVALENT_CLASSES)); g.addSupportOntology(secondary); Mooncat mooncat = new Mooncat(g); //mooncat.mergeOntologies(); g.mergeOntology(secondary); OWLOntology merged = g.getSourceOntology(); System.out.println(merged.getAxioms(AxiomType.EQUIVALENT_CLASSES)); Owl2Obo owl2Obo = new Owl2Obo(); OBODoc mergedObo = owl2Obo.convert(merged); if (USE_SYSTEM_OUT) { System.out.println("------------------------"); OWLOntologyManager manager = merged.getOWLOntologyManager(); OWLOntologyDocumentTarget documentTarget = new SystemOutDocumentTarget(); manager.saveOntology(merged, new RDFXMLDocumentFormat(), documentTarget); System.out.println("------------------------"); String oboString = renderOBOtoString(mergedObo); System.out.println(oboString); System.out.println("------------------------"); } Frame headerFrame = mergedObo.getHeaderFrame(); String owlAxiomString = headerFrame.getTagValue(OboFormatTag.TAG_OWL_AXIOMS, String.class); assertNotNull(owlAxiomString); Frame frame = mergedObo.getTermFrame("X:1"); Collection<Clause> clauses = frame.getClauses(OboFormatTag.TAG_INTERSECTION_OF); assertEquals(2, clauses.size()); }