Last active
December 14, 2015 23:29
-
-
Save balhoff/5165862 to your computer and use it in GitHub Desktop.
Testing Manchester syntax-like wrapper for OWLAPI in Scala.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, _)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very nice