From: <lor...@us...> - 2011-08-15 07:30:24
|
Revision: 3038 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3038&view=rev Author: lorenz_b Date: 2011-08-15 07:30:18 +0000 (Mon, 15 Aug 2011) Log Message: ----------- Continued output. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/core/EvaluatedAxiom.java trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java 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 16:01:34 UTC (rev 3037) +++ trunk/components-core/src/main/java/org/dllearner/core/EvaluatedAxiom.java 2011-08-15 07:30:18 UTC (rev 3038) @@ -1,14 +1,26 @@ package org.dllearner.core; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + import org.apache.commons.codec.digest.DigestUtils; import org.dllearner.core.owl.Axiom; import org.dllearner.utilities.EnrichmentVocabulary; +import org.dllearner.utilities.owl.OWLAPIConverter; +import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.semanticweb.owlapi.model.IRI; +import org.semanticweb.owlapi.model.OWLAnnotation; +import org.semanticweb.owlapi.model.OWLAnnotationAxiom; import org.semanticweb.owlapi.model.OWLAxiom; import org.semanticweb.owlapi.model.OWLDataFactory; import org.semanticweb.owlapi.model.OWLNamedIndividual; +import org.semanticweb.owlapi.util.DefaultPrefixManager; import uk.ac.manchester.cs.owl.owlapi.OWLDataFactoryImpl; +import uk.ac.manchester.cs.owl.owlapi.mansyntaxrenderer.ManchesterOWLSyntaxObjectRenderer; +import uk.ac.manchester.cs.owl.owlapi.mansyntaxrenderer.ManchesterOWLSyntaxPrefixNameShortFormProvider; public class EvaluatedAxiom { @@ -33,17 +45,29 @@ return axiom + "(" + score.getAccuracy()+ ")"; } - public void toRDF(){ + public List<OWLAxiom> toRDF(){ OWLDataFactory f = new OWLDataFactoryImpl(); String id = DigestUtils.md5Hex(axiom.toString()) + score.getAccuracy(); OWLNamedIndividual ind = f.getOWLNamedIndividual(IRI.create(EnrichmentVocabulary.NS + id)); + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + ManchesterOWLSyntaxObjectRenderer r = new ManchesterOWLSyntaxObjectRenderer(pw, new ManchesterOWLSyntaxPrefixNameShortFormProvider(new DefaultPrefixManager())); + OWLAxiom ax = OWLAPIConverter.getOWLAPIAxiom(axiom); + ax.accept(r); + OWLAxiom ax1 = f.getOWLClassAssertionAxiom(EnrichmentVocabulary.Suggestion, ind); - OWLAxiom ax2 = f.getOWLObjectPropertyAssertionAxiom(EnrichmentVocabulary.hasAxiom, ind, null); + OWLAxiom ax2 = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.hasAxiom, ind, sw.toString()); OWLAxiom ax3 = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.confidence, ind, score.getAccuracy()); - System.out.println(ax1); + List<OWLAxiom> axioms = new ArrayList<OWLAxiom>(); + axioms.add(ax1); + axioms.add(ax2); + axioms.add(ax3); + + return axioms; } Modified: trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java 2011-08-11 16:01:34 UTC (rev 3037) +++ trunk/components-core/src/main/java/org/dllearner/utilities/EnrichmentVocabulary.java 2011-08-15 07:30:18 UTC (rev 3038) @@ -25,7 +25,7 @@ //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 hasAxiom = factory.getOWLObjectProperty(IRI.create(NS + "hasAxiom")); public static final OWLObjectProperty hasChange = factory.getOWLObjectProperty(IRI.create(NS + "hasChange")); @@ -49,4 +49,6 @@ public static final OWLDataProperty version = factory.getOWLDataProperty(IRI.create(NS + "version")); + public static final OWLDataProperty hasAxiom = factory.getOWLDataProperty(IRI.create(NS + "hasAxiom")); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |