|
From: <lor...@us...> - 2014-08-06 12:19:53
|
Revision: 4285
http://sourceforge.net/p/dl-learner/code/4285
Author: lorenz_b
Date: 2014-08-06 12:19:49 +0000 (Wed, 06 Aug 2014)
Log Message:
-----------
Updated OWL API.
Added Paths:
-----------
trunk/components-core/src/main/java/org/dllearner/reasoning/OWLPunningDetector.java
Added: trunk/components-core/src/main/java/org/dllearner/reasoning/OWLPunningDetector.java
===================================================================
--- trunk/components-core/src/main/java/org/dllearner/reasoning/OWLPunningDetector.java (rev 0)
+++ trunk/components-core/src/main/java/org/dllearner/reasoning/OWLPunningDetector.java 2014-08-06 12:19:49 UTC (rev 4285)
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.dllearner.reasoning;
+
+import org.dllearner.core.owl.NamedClass;
+import org.dllearner.core.owl.ObjectProperty;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+/**
+ * @author Lorenz Buehmann
+ *
+ */
+public class OWLPunningDetector {
+
+ /**
+ * This object property is used to connect individuals with classes that are also individuals, thus, lead to punning.
+ */
+ public static final ObjectProperty punningProperty = new ObjectProperty("http://dl-learner.org/punning/relatedTo");
+
+ /**
+ * Checks whether the same IRI denotes both a class and an individual in the ontology.
+ * @param ontology
+ * @param iri
+ * @return
+ */
+ public static boolean hasPunning(OWLOntology ontology, NamedClass cls){
+ return hasPunning(ontology, IRI.create(cls.getName()));
+ }
+
+ /**
+ * Checks whether the same IRI denotes both a class and an individual in the ontology.
+ * @param ontology
+ * @param iri
+ * @return
+ */
+ public static boolean hasPunning(OWLOntology ontology, IRI iri){
+ boolean isClass = ontology.getClassesInSignature().contains(ontology.getOWLOntologyManager().getOWLDataFactory().getOWLClass(iri));
+ boolean isIndividual = ontology.getIndividualsInSignature().contains(ontology.getOWLOntologyManager().getOWLDataFactory().getOWLNamedIndividual(iri));
+ return isClass && isIndividual;
+ }
+
+ /**
+ * Checks whether the same IRI denotes both a class and an individual in the ontology.
+ * @param ontology
+ * @param iri
+ * @return
+ */
+ public static boolean hasPunning(OWLOntology ontology, String iri){
+ return hasPunning(ontology, IRI.create(iri));
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|