From: <ku...@us...> - 2009-09-30 06:19:21
|
Revision: 1870 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1870&view=rev Author: kurzum Date: 2009-09-30 06:19:13 +0000 (Wed, 30 Sep 2009) Log Message: ----------- some minor changes and test case Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/test/JenaConstruct.java Modified: trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java 2009-09-29 15:59:38 UTC (rev 1869) +++ trunk/src/dl-learner/org/dllearner/kb/manipulator/AddAllStringsAsClasses.java 2009-09-30 06:19:13 UTC (rev 1870) @@ -101,6 +101,7 @@ } tmp = namespace+tmp; tmp = tmp.replaceAll("%", "_"); + tmp = "c"+tmp; keep.add(new RDFNodeTuple(new ResourceImpl(OWLVocabulary.RDF_TYPE),new ResourceImpl(tmp))); }else { Added: trunk/src/dl-learner/org/dllearner/test/JenaConstruct.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/JenaConstruct.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/JenaConstruct.java 2009-09-30 06:19:13 UTC (rev 1870) @@ -0,0 +1,84 @@ +package org.dllearner.test; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URI; +import java.net.URL; +import java.net.URLConnection; + +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyManager; + + + +/** + * this class was submitted to Jena Bug Tracker + * + */ +public class JenaConstruct { + + public static void main(String[] args) { + try{ + URL url = new URL ("http://localhost/ontowiki/model/export/?m=http://ns.softwiki.de/req/&f=rdfxml"); + getWholeOWLAPIOntology(url); + }catch (Exception e) { + e.printStackTrace(); + } + } + +public static OWLOntology getWholeOWLAPIOntology(URL url){ + OWLOntology onto = null; + try{ + File f = File.createTempFile("dllearneronto", ".rdf"); + try{ + //assemble + + //URL url = new URL (owbase+"model/export/?m="+namespace+"&f=rdfxml"); +// URLConnection u = url.openConnection(); +// String content = toString(u.getInputStream()); +// +// +// FileWriter fw = new FileWriter(f); +// fw.write(content); +// fw.close(); + URI physicalURI = url.toURI(); +// URI physicalURI = f.toURI(); + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + onto = manager.loadOntologyFromPhysicalURI(physicalURI); + System.out.println(onto.getAxiomCount()); + }catch (Exception e) { + e.printStackTrace(); + }finally{ + f.delete(); + + } + + }catch (Exception e) { + e.printStackTrace(); + } + return onto; + +} + + public static String toString(InputStream in) + throws IOException +{ + + BufferedReader reader = new BufferedReader(new InputStreamReader(in)); + + String result = ""; + String line; + while(null != (line = reader.readLine())){ + if(line.startsWith("#")){continue;} + result += line + "\n"; + } + return result; +} + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |