From: <jen...@us...> - 2010-03-24 09:04:00
|
Revision: 2133 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2133&view=rev Author: jenslehmann Date: 2010-03-24 09:03:52 +0000 (Wed, 24 Mar 2010) Log Message: ----------- convenience Manchester Syntax parsing method Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java Added: trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java 2010-03-24 09:03:52 UTC (rev 2133) @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.test.junit; + +import org.dllearner.core.owl.Description; +import org.dllearner.utilities.owl.ManchesterOWLSyntaxParser; +import org.junit.Test; +import org.semanticweb.owl.expression.ParserException; + +/** + * + * OWL API specific tests. + * + * @author Jens Lehmann + * + */ +public class OWLAPITests { + + @Test + public void testManchesterSyntaxParser() throws ParserException { +// String s = "BIGPROP SOME smallclass"; +// String s = "http://test.de/prop some http://test.de/Class"; + String s = "http://test.de/Class"; + Description d = ManchesterOWLSyntaxParser.getDescription(s); + System.out.println(d); + } + +} Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java 2010-03-23 20:13:28 UTC (rev 2132) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java 2010-03-24 09:03:52 UTC (rev 2133) @@ -20,6 +20,7 @@ package org.dllearner.utilities.owl; import org.coode.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser; +import org.dllearner.core.owl.Description; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.expression.ParserException; import org.semanticweb.owl.model.OWLDescription; @@ -27,22 +28,22 @@ /** * Parser for Manchester Syntax strings (interface to OWL API parser). - * TODO: Currently, this outputs an OWL API OWLDescription, but there - * is no converter from OWL API descriptions to DL-Learner descriptions - * at the moment. * * @author Jens Lehmann * */ public class ManchesterOWLSyntaxParser { - public OWLDescription getDescription(String manchesterSyntaxDescription) throws ParserException { + public static OWLDescription getOWLAPIDescription(String manchesterSyntaxDescription) throws ParserException { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - ManchesterOWLSyntaxEditorParser parser = new ManchesterOWLSyntaxEditorParser(manager.getOWLDataFactory(), manchesterSyntaxDescription); - return parser.parseDescription(); } + + public static Description getDescription(String manchesterSyntaxDescription) throws ParserException { + OWLDescription d = getOWLAPIDescription(manchesterSyntaxDescription); + return DLLearnerDescriptionConvertVisitor.getDLLearnerDescription(d); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |