Skip to content

Commit

Permalink
Added missing property axiom types.
Browse files Browse the repository at this point in the history
  • Loading branch information
balhoff committed Dec 29, 2016
1 parent 31d498b commit 01e977f
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 6 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ organization := "org.phenoscape"

name := "scowl"

version := "1.1"
version := "1.2-SNAPSHOT"

crossScalaVersions := Seq("2.10.6", "2.11.7")

Expand All @@ -13,7 +13,7 @@ javaOptions += "-Xmx8G"

libraryDependencies ++= {
Seq(
"net.sourceforge.owlapi" % "owlapi-distribution" % "4.2.1",
"net.sourceforge.owlapi" % "owlapi-distribution" % "4.2.7",
"org.scalatest" %% "scalatest" % "2.2.6" % Test,
"org.scalaz" %% "scalaz-core" % "7.2.1" % Test
)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.9
sbt.version=0.13.13
79 changes: 77 additions & 2 deletions src/main/scala/org/phenoscape/scowl/ofn/PropertyAxioms.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package org.phenoscape.scowl.ofn

import scala.collection.JavaConversions._

import org.semanticweb.owlapi.apibinding.OWLManager
import org.semanticweb.owlapi.model.OWLAnnotation
import org.semanticweb.owlapi.model.OWLAsymmetricObjectPropertyAxiom
import org.semanticweb.owlapi.model.OWLClassExpression
import org.semanticweb.owlapi.model.OWLDataPropertyDomainAxiom
import org.semanticweb.owlapi.model.OWLDataPropertyExpression
import org.semanticweb.owlapi.model.OWLDataPropertyRangeAxiom
import org.semanticweb.owlapi.model.OWLDataRange
import org.semanticweb.owlapi.model.OWLDisjointDataPropertiesAxiom
import org.semanticweb.owlapi.model.OWLDisjointObjectPropertiesAxiom
import org.semanticweb.owlapi.model.OWLEquivalentDataPropertiesAxiom
import org.semanticweb.owlapi.model.OWLEquivalentObjectPropertiesAxiom
import org.semanticweb.owlapi.model.OWLFunctionalDataPropertyAxiom
import org.semanticweb.owlapi.model.OWLFunctionalObjectPropertyAxiom
import org.semanticweb.owlapi.model.OWLInverseFunctionalObjectPropertyAxiom
Expand All @@ -19,15 +24,15 @@ import org.semanticweb.owlapi.model.OWLObjectPropertyExpression
import org.semanticweb.owlapi.model.OWLObjectPropertyRangeAxiom
import org.semanticweb.owlapi.model.OWLPropertyExpression
import org.semanticweb.owlapi.model.OWLReflexiveObjectPropertyAxiom
import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom
import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom
import org.semanticweb.owlapi.model.OWLSubPropertyChainOfAxiom
import org.semanticweb.owlapi.model.OWLSymmetricObjectPropertyAxiom
import org.semanticweb.owlapi.model.OWLTransitiveObjectPropertyAxiom
import org.semanticweb.owlapi.model.OWLUnaryPropertyAxiom
import org.semanticweb.owlapi.apibinding.OWLManager

trait PropertyAxioms {

private val factory = OWLManager.getOWLDataFactory

object SubObjectPropertyOf {
Expand Down Expand Up @@ -56,6 +61,57 @@ trait PropertyAxioms {

}

object SubDataPropertyOf {

def apply(annotations: Set[OWLAnnotation], subProperty: OWLDataPropertyExpression, superProperty: OWLDataPropertyExpression): OWLSubDataPropertyOfAxiom =
factory.getOWLSubDataPropertyOfAxiom(subProperty, superProperty)

def apply(subProperty: OWLDataPropertyExpression, superProperty: OWLDataPropertyExpression): OWLSubDataPropertyOfAxiom =
apply(Set.empty, subProperty, superProperty)

def unapply(axiom: OWLSubDataPropertyOfAxiom): Option[(Set[OWLAnnotation], OWLDataPropertyExpression, OWLDataPropertyExpression)] =
Option(axiom.getAnnotations.toSet, axiom.getSubProperty, axiom.getSuperProperty)

}

object EquivalentObjectProperties {

def apply(annotations: Set[OWLAnnotation], propertyExpressions: Set[OWLObjectPropertyExpression]): OWLEquivalentObjectPropertiesAxiom =
factory.getOWLEquivalentObjectPropertiesAxiom(propertyExpressions, annotations)

def apply(properties: OWLObjectPropertyExpression*): OWLEquivalentObjectPropertiesAxiom =
apply(Set.empty[OWLAnnotation], properties.toSet)

def apply(properties: Set[OWLObjectPropertyExpression]): OWLEquivalentObjectPropertiesAxiom =
apply(Set.empty[OWLAnnotation], properties)

def apply(annotations: OWLAnnotation*)(properties: OWLObjectPropertyExpression*): OWLEquivalentObjectPropertiesAxiom =
apply(annotations.toSet, properties.toSet)

def unapply(axiom: OWLEquivalentObjectPropertiesAxiom): Option[(Set[OWLAnnotation], Set[OWLObjectPropertyExpression])] =
Option(axiom.getAnnotations.toSet, axiom.getProperties.toSet)

}

object EquivalentDataProperties {

def apply(annotations: Set[OWLAnnotation], propertyExpressions: Set[OWLDataPropertyExpression]): OWLEquivalentDataPropertiesAxiom =
factory.getOWLEquivalentDataPropertiesAxiom(propertyExpressions, annotations)

def apply(properties: OWLDataPropertyExpression*): OWLEquivalentDataPropertiesAxiom =
apply(Set.empty[OWLAnnotation], properties.toSet)

def apply(properties: Set[OWLDataPropertyExpression]): OWLEquivalentDataPropertiesAxiom =
apply(Set.empty[OWLAnnotation], properties)

def apply(annotations: OWLAnnotation*)(properties: OWLDataPropertyExpression*): OWLEquivalentDataPropertiesAxiom =
apply(annotations.toSet, properties.toSet)

def unapply(axiom: OWLEquivalentDataPropertiesAxiom): Option[(Set[OWLAnnotation], Set[OWLDataPropertyExpression])] =
Option(axiom.getAnnotations.toSet, axiom.getProperties.toSet)

}

object ObjectPropertyDomain {

def apply(annotations: Set[OWLAnnotation], property: OWLObjectPropertyExpression, domain: OWLClassExpression): OWLObjectPropertyDomainAxiom =
Expand Down Expand Up @@ -140,6 +196,25 @@ trait PropertyAxioms {

}

object DisjointDataProperties {

def apply(annotations: Set[OWLAnnotation], properties: Set[OWLDataPropertyExpression]): OWLDisjointDataPropertiesAxiom =
factory.getOWLDisjointDataPropertiesAxiom(properties, annotations)

def apply(properties: OWLDataPropertyExpression*): OWLDisjointDataPropertiesAxiom =
apply(Set.empty[OWLAnnotation], properties.toSet)

def apply(properties: Set[OWLDataPropertyExpression]): OWLDisjointDataPropertiesAxiom =
apply(Set.empty[OWLAnnotation], properties)

def apply(annotations: OWLAnnotation*)(properties: OWLDataPropertyExpression*): OWLDisjointDataPropertiesAxiom =
apply(annotations.toSet, properties.toSet)

def unapply(axiom: OWLDisjointDataPropertiesAxiom): Option[(Set[OWLAnnotation], Set[OWLDataPropertyExpression])] =
Option(axiom.getAnnotations.toSet, axiom.getProperties.toSet)

}

object SymmetricObjectProperty extends UnaryObjectPropertyAxiom[OWLSymmetricObjectPropertyAxiom, OWLObjectPropertyExpression] {

val constructor = factory.getOWLSymmetricObjectPropertyAxiom(_: OWLObjectPropertyExpression, _: Set[OWLAnnotation])
Expand Down
15 changes: 14 additions & 1 deletion src/main/scala/org/phenoscape/scowl/package.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.phenoscape

import scala.collection.JavaConversions._

import org.phenoscape.scowl.converters.AnnotationValuer
import org.phenoscape.scowl.converters.Literalable
import org.phenoscape.scowl.converters.SWRLDArgish
Expand Down Expand Up @@ -40,8 +41,11 @@ import org.semanticweb.owlapi.model.OWLDatatypeDefinitionAxiom
import org.semanticweb.owlapi.model.OWLDatatypeRestriction
import org.semanticweb.owlapi.model.OWLDifferentIndividualsAxiom
import org.semanticweb.owlapi.model.OWLDisjointClassesAxiom
import org.semanticweb.owlapi.model.OWLDisjointDataPropertiesAxiom
import org.semanticweb.owlapi.model.OWLDisjointObjectPropertiesAxiom
import org.semanticweb.owlapi.model.OWLEquivalentClassesAxiom
import org.semanticweb.owlapi.model.OWLEquivalentDataPropertiesAxiom
import org.semanticweb.owlapi.model.OWLEquivalentObjectPropertiesAxiom
import org.semanticweb.owlapi.model.OWLFacetRestriction
import org.semanticweb.owlapi.model.OWLHasKeyAxiom
import org.semanticweb.owlapi.model.OWLIndividual
Expand All @@ -68,14 +72,15 @@ import org.semanticweb.owlapi.model.OWLObjectUnionOf
import org.semanticweb.owlapi.model.OWLPropertyExpression
import org.semanticweb.owlapi.model.OWLSameIndividualAxiom
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom
import org.semanticweb.owlapi.model.OWLSubDataPropertyOfAxiom
import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom
import org.semanticweb.owlapi.model.OWLSubPropertyChainOfAxiom
import org.semanticweb.owlapi.model.SWRLAtom
import org.semanticweb.owlapi.model.SWRLClassAtom
import org.semanticweb.owlapi.model.SWRLDataPropertyAtom
import org.semanticweb.owlapi.model.SWRLDataRangeAtom
import org.semanticweb.owlapi.model.SWRLObjectPropertyAtom
import org.semanticweb.owlapi.model.SWRLRule
import org.semanticweb.owlapi.model.SWRLDataRangeAtom

package object scowl extends Vocab
with ofn.Entities
Expand Down Expand Up @@ -205,6 +210,8 @@ package object scowl extends Vocab

def value(individual: OWLIndividual): OWLObjectHasValue = factory.getOWLObjectHasValue(self, individual)

def EquivalentTo(other: OWLObjectPropertyExpression): OWLEquivalentObjectPropertiesAxiom = factory.getOWLEquivalentObjectPropertiesAxiom(self, other)

def SubPropertyOf(other: OWLObjectPropertyExpression): OWLSubObjectPropertyOfAxiom = factory.getOWLSubObjectPropertyOfAxiom(self, other)

def o(property: OWLObjectPropertyExpression): ScowlPropertyChain = new ScowlPropertyChain(self, property)
Expand Down Expand Up @@ -254,10 +261,16 @@ package object scowl extends Vocab
factory.getOWLDataHasValue(self, literalable.toLiteral(value))
}

def EquivalentTo(other: OWLDataPropertyExpression): OWLEquivalentDataPropertiesAxiom = factory.getOWLEquivalentDataPropertiesAxiom(self, other)

def SubPropertyOf(other: OWLDataPropertyExpression): OWLSubDataPropertyOfAxiom = factory.getOWLSubDataPropertyOfAxiom(self, other)

def Domain(domain: OWLClassExpression): OWLDataPropertyDomainAxiom = factory.getOWLDataPropertyDomainAxiom(self, domain)

def Range(range: OWLDataRange): OWLDataPropertyRangeAxiom = factory.getOWLDataPropertyRangeAxiom(self, range)

def DisjointWith(other: OWLDataPropertyExpression): OWLDisjointDataPropertiesAxiom = factory.getOWLDisjointDataPropertiesAxiom(self, other)

def Characteristic[T <: OWLDataPropertyCharacteristicAxiom](characteristic: PropertyCharacteristic[_, T]): T = characteristic.axiom(self)

def apply[S: SWRLIArgish, V: SWRLDArgish](subj: S, value: V): SWRLDataPropertyAtom = {
Expand Down

0 comments on commit 01e977f

Please sign in to comment.