Skip to content

Commit

Permalink
Testing ComplementOf-SomeValuesFrom expressions, see geneontology/noc…
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed Aug 24, 2017
1 parent 20e172c commit 0c5eac7
Showing 1 changed file with 38 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import org.semanticweb.owlapi.model.IRI;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLDataFactory;
import org.semanticweb.owlapi.model.OWLObjectComplementOf;
import org.semanticweb.owlapi.model.OWLObjectSomeValuesFrom;
import org.semanticweb.owlapi.model.OWLOntologyCreationException;

import owltools.graph.OWLGraphWrapper;
Expand Down Expand Up @@ -118,20 +120,45 @@ public void testParseClazz() throws Exception {
assertEquals(graph.getOWLClassByIdentifier(CELL_MORPHOGENESIS), ce);
}

@Test
public void testParseClazzNegated() throws Exception {
@Test
public void testParseClazzNegated() throws Exception {

JsonOwlObject expression = new JsonOwlObject();
expression.type = JsonOwlObjectType.ComplementOf;
expression.filler = new JsonOwlObject();
expression.filler.id = NUCLEUS;
JsonOwlObject expression = new JsonOwlObject();
expression.type = JsonOwlObjectType.ComplementOf;
expression.filler = new JsonOwlObject();
expression.filler.id = NUCLEUS;
expression.filler.type = JsonOwlObjectType.Class;

OWLClassExpression ce = new M3ExpressionParser(curieHandler).parse(graph, expression, null);
OWLClass nucleus = graph.getOWLClassByIdentifier(NUCLEUS);
OWLObjectComplementOf ceExpected = graph.getDataFactory().getOWLObjectComplementOf(nucleus);
assertEquals(ceExpected, ce);
}
OWLClassExpression ce = new M3ExpressionParser(curieHandler).parse(graph, expression, null);
OWLClass nucleus = graph.getOWLClassByIdentifier(NUCLEUS);
OWLObjectComplementOf ceExpected = graph.getDataFactory().getOWLObjectComplementOf(nucleus);
assertEquals(ceExpected, ce);
}

@Test
public void testParseClazzNegatedExpression() throws Exception {

JsonOwlObject svf = new JsonOwlObject();
svf.type = JsonOwlObjectType.SomeValueFrom;
svf.property = new JsonOwlObject();
svf.property.type = JsonOwlObjectType.ObjectProperty;
svf.property.id = OCCURS_IN; // occurs_in
svf.filler = new JsonOwlObject();
svf.filler.id = NUCLEUS;
svf.filler.type = JsonOwlObjectType.Class;

JsonOwlObject expression = new JsonOwlObject();
expression.type = JsonOwlObjectType.ComplementOf;
expression.filler = svf;

OWLDataFactory df = graph.getDataFactory();
OWLClassExpression ce = new M3ExpressionParser(curieHandler).parse(graph, expression, null);

OWLClass nucleus = graph.getOWLClassByIdentifier(NUCLEUS);
OWLObjectSomeValuesFrom svfx = df.getOWLObjectSomeValuesFrom(graph.getOWLObjectPropertyByIdentifier(OCCURS_IN), nucleus);
OWLObjectComplementOf ceExpected = df.getOWLObjectComplementOf(svfx);
assertEquals(ceExpected, ce);
}


/**
Expand Down

0 comments on commit 0c5eac7

Please sign in to comment.