Skip to content

Instantly share code, notes, and snippets.

@balhoff
Last active December 14, 2015 23:29
Show Gist options
  • Save balhoff/5165862 to your computer and use it in GitHub Desktop.
Save balhoff/5165862 to your computer and use it in GitHub Desktop.
Testing Manchester syntax-like wrapper for OWLAPI in Scala.
package org.nescent.ontology
import scala.collection.JavaConversions._
import org.nescent.ontology.OWL._
import org.nescent.ontology.OWLConversions._
import org.semanticweb.owlapi.apibinding.OWLManager
object OWLAPITest extends App {
val manager = OWLManager.createOWLOntologyManager();
val ontology = manager.createOntology();
val partOf = ObjectProperty("http://example.org/part_of");
val hasPart = ObjectProperty("http://example.org/has_part");
val developsFrom = ObjectProperty("http://example.org/develops_from");
val eye = Class("http://example.org/eye");
val head = Class("http://example.org/head");
val tail = Class("http://example.org/tail");
manager.addAxiom(ontology, eye SubClassOf (partOf some head));
manager.addAxiom(ontology, eye SubClassOf (not (partOf some tail)));
ontology.getClassesInSignature(true).map (c =>
(not (hasPart some c)) SubClassOf (not (hasPart some (developsFrom some c)))
) foreach (manager.addAxiom(ontology, _));
}
@cmungall
Copy link

very nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment