From: <lor...@us...> - 2011-08-11 14:20:56
|
Revision: 3032 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3032&view=rev Author: lorenz_b Date: 2011-08-11 14:20:49 +0000 (Thu, 11 Aug 2011) Log Message: ----------- Added preliminary utility class for vocabulary of enrichments. Modified Paths: -------------- trunk/components-core/pom.xml trunk/components-core/src/main/java/org/dllearner/core/EvaluatedAxiom.java Added Paths: ----------- trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java Modified: trunk/components-core/pom.xml =================================================================== --- trunk/components-core/pom.xml 2011-08-11 12:56:45 UTC (rev 3031) +++ trunk/components-core/pom.xml 2011-08-11 14:20:49 UTC (rev 3032) @@ -225,6 +225,11 @@ <groupId>com.jamonapi</groupId> <artifactId>jamon</artifactId> </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-digester3</artifactId> + </dependency> <!--JENA ARQ is in central - we use the latest--> <dependency> @@ -276,5 +281,10 @@ <artifactId>slf4j-api</artifactId> <version>1.5.8</version> </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>20041127.091804</version> + </dependency> </dependencies> </project> Modified: trunk/components-core/src/main/java/org/dllearner/core/EvaluatedAxiom.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/EvaluatedAxiom.java 2011-08-11 12:56:45 UTC (rev 3031) +++ trunk/components-core/src/main/java/org/dllearner/core/EvaluatedAxiom.java 2011-08-11 14:20:49 UTC (rev 3032) @@ -1,7 +1,15 @@ package org.dllearner.core; +import org.apache.commons.codec.digest.DigestUtils; import org.dllearner.core.owl.Axiom; +import org.dllearner.utilities.EnrichmentVocabulary; +import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLAxiom; +import org.semanticweb.owlapi.model.OWLDataFactory; +import org.semanticweb.owlapi.model.OWLNamedIndividual; +import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl; + public class EvaluatedAxiom { private Axiom axiom; @@ -25,6 +33,18 @@ return axiom + "(" + score.getAccuracy()+ ")"; } + public void toRDF(){ + OWLDataFactory f = new OWLDataFactoryImpl(); + + String id = DigestUtils.md5Hex(axiom.toString()) + score.getAccuracy(); + OWLNamedIndividual ind = f.getOWLNamedIndividual(IRI.create(EnrichmentVocabulary.NS + id)); + + OWLAxiom ax1 = f.getOWLClassAssertionAxiom(EnrichmentVocabulary.Suggestion, ind); + OWLAxiom ax2 = f.getOWLObjectPropertyAssertionAxiom(EnrichmentVocabulary.hasAxiom, ind, null); + OWLAxiom ax3 = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.confidence, ind, score.getAccuracy()); + + System.out.println(ax1); + } } Added: trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java (rev 0) +++ trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java 2011-08-11 14:20:49 UTC (rev 3032) @@ -0,0 +1,52 @@ +package org.dllearner.utilities; + +import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLClass; +import org.semanticweb.owlapi.model.OWLDataFactory; +import org.semanticweb.owlapi.model.OWLDataProperty; +import org.semanticweb.owlapi.model.OWLObjectProperty; + +import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl; + +public class EnrichmentVocabulary { + + private static final OWLDataFactory factory = new OWLDataFactoryImpl(); + + public static final String NS = "http://www.dl-learner.org/enrichment.owl#"; + + //the classes + public static final OWLClass ChangeSet = factory.getOWLClass(IRI.create(NS + "ChangeSet")); + + public static final OWLClass Suggestion = factory.getOWLClass(IRI.create(NS + "Suggestion")); + + public static final OWLClass Parameter = factory.getOWLClass(IRI.create(NS + "Parameter")); + + + //the object properties + public static final OWLObjectProperty creation = factory.getOWLObjectProperty(IRI.create(NS + "creation")); + + public static final OWLObjectProperty hasAxiom = factory.getOWLObjectProperty(IRI.create(NS + "hasAxiom")); + + public static final OWLObjectProperty hasChange = factory.getOWLObjectProperty(IRI.create(NS + "hasChange")); + + public static final OWLObjectProperty hasInput = factory.getOWLObjectProperty(IRI.create(NS + "hasInput")); + + public static final OWLObjectProperty hasParameter = factory.getOWLObjectProperty(IRI.create(NS + "hasParameter")); + + public static final OWLObjectProperty usedAlgorithm = factory.getOWLObjectProperty(IRI.create(NS + "usedAlgorithm")); + + + //the data properties + public static final OWLDataProperty confidence = factory.getOWLDataProperty(IRI.create(NS + "confidence")); + + public static final OWLDataProperty explanation = factory.getOWLDataProperty(IRI.create(NS + "explanation")); + + public static final OWLDataProperty parameterName = factory.getOWLDataProperty(IRI.create(NS + "parameterName")); + + public static final OWLDataProperty parameterValue = factory.getOWLDataProperty(IRI.create(NS + "parameterValue")); + + public static final OWLDataProperty timestamp = factory.getOWLDataProperty(IRI.create(NS + "timestamp")); + + public static final OWLDataProperty version = factory.getOWLDataProperty(IRI.create(NS + "version")); + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |