changeset 0:47075a8171a6

initial
author dwinter
date Thu, 08 Dec 2011 08:50:00 +0100
parents
children 7d7b9c6fbb36
files .classpath .project .settings/org.eclipse.core.resources.prefs .settings/org.eclipse.jdt.core.prefs lib/jena.jar lib/log4j-1.2.15.jar lib/openrdf-sesame-2.3.2-onejar.jar lib/virt_sesame2.jar lib/virtjdbc3.jar lib/virtjdbc4.jar src/de/mpiwg/itgroup/triplestoremanager/exceptions/TripleStoreHandlerException.java src/de/mpiwg/itgroup/triplestoremanager/owl/MetaDataHandler.java src/de/mpiwg/itgroup/triplestoremanager/owl/TripleStoreHandler.java src/de/mpiwg/itgroup/triplestoremanager/owl/Util.java
diffstat 14 files changed, 1246 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.classpath	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.15.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/openrdf-sesame-2.3.2-onejar.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/virt_sesame2.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/virtjdbc3.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/virtjdbc4.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/protege"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/protege-core"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.project	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,419 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>TripleStoreManager</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+	<linkedResources>
+		<link>
+			<name>ontologies</name>
+			<type>2</type>
+			<locationURI>virtual:/virtual</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg</name>
+			<type>2</type>
+			<locationURI>virtual:/virtual</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.project</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.project</locationURI>
+		</link>
+		<link>
+			<name>ontologies/MPIWGGeneral.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/MPIWGGeneral.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/MPIWGGeneral.pprj</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/MPIWGGeneral.pprj</locationURI>
+		</link>
+		<link>
+			<name>ontologies/MPIWGGeneral.repository</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/MPIWGGeneral.repository</locationURI>
+		</link>
+		<link>
+			<name>ontologies/annotation-ns.rdf</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/annotation-ns.rdf</locationURI>
+		</link>
+		<link>
+			<name>ontologies/annotationType.rdf</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/annotationType.rdf</locationURI>
+		</link>
+		<link>
+			<name>ontologies/annotations.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/annotations.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/annotations.pprj</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/annotations.pprj</locationURI>
+		</link>
+		<link>
+			<name>ontologies/annotations.repository</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/annotations.repository</locationURI>
+		</link>
+		<link>
+			<name>ontologies/catalog-v001.xml</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/catalog-v001.xml</locationURI>
+		</link>
+		<link>
+			<name>ontologies/dbpedia_3.6.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/dbpedia_3.6.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/dcterms.rdf</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/dcterms.rdf</locationURI>
+		</link>
+		<link>
+			<name>ontologies/ecrm_110404.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/ecrm_110404.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/ecrm_plus_110404_dw.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/ecrm_plus_110404_dw.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/foaf.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/foaf.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/namedIdentities.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/namedIdentities.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/namedIdentities.owl~</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/namedIdentities.owl~</locationURI>
+		</link>
+		<link>
+			<name>ontologies/namedIdentities.pprj</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/namedIdentities.pprj</locationURI>
+		</link>
+		<link>
+			<name>ontologies/namedIdentities.repository</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/namedIdentities.repository</locationURI>
+		</link>
+		<link>
+			<name>ontologies/namedIdentitiesTest.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/namedIdentitiesTest.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/namedIdentitiesTest.pprj</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/namedIdentitiesTest.pprj</locationURI>
+		</link>
+		<link>
+			<name>ontologies/namedIdentitiesTest.repository</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/namedIdentitiesTest.repository</locationURI>
+		</link>
+		<link>
+			<name>ontologies/openannotation.rdf</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/openannotation.rdf</locationURI>
+		</link>
+		<link>
+			<name>ontologies/personsLibrary.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/personsLibrary.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/personsLibrary.pprj</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/personsLibrary.pprj</locationURI>
+		</link>
+		<link>
+			<name>ontologies/personsLibrary.repository</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/personsLibrary.repository</locationURI>
+		</link>
+		<link>
+			<name>ontologies/rdf-schema</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/rdf-schema</locationURI>
+		</link>
+		<link>
+			<name>ontologies/skos-owl1-dl.rdf</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/skos-owl1-dl.rdf</locationURI>
+		</link>
+		<link>
+			<name>ontologies/test.owl</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/test.owl</locationURI>
+		</link>
+		<link>
+			<name>ontologies/test.repository</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/test.repository</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/00changelog.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/00changelog.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/cache</name>
+			<type>2</type>
+			<locationURI>virtual:/virtual</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/dirstate</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/dirstate</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/last-message.txt</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/last-message.txt</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/requires</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/requires</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store</name>
+			<type>2</type>
+			<locationURI>virtual:/virtual</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/undo.bookmarks</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/undo.bookmarks</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/undo.branch</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/undo.branch</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/undo.desc</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/undo.desc</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/undo.dirstate</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/undo.dirstate</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/cache/tags</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/cache/tags</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/00changelog.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/00changelog.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/00manifest.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/00manifest.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data</name>
+			<type>2</type>
+			<locationURI>virtual:/virtual</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/fncache</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/fncache</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/undo</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/undo</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/_m_p_i_w_g_general.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/_m_p_i_w_g_general.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/_m_p_i_w_g_general.pprj.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/_m_p_i_w_g_general.pprj.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/_m_p_i_w_g_general.repository.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/_m_p_i_w_g_general.repository.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotation-ns.rdf.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotation-ns.rdf.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotation_type.rdf.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotation_type.rdf.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotations.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotations.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotations.pprj.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotations.pprj.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotations.repository.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotations.repository.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotations__annotator.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotations__annotator.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotations__annotator.pprj.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotations__annotator.pprj.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/annotations__annotator.repository.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/annotations__annotator.repository.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/catalog-v001.xml.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/catalog-v001.xml.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/dbpedia__3.6.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/dbpedia__3.6.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/dcterms.rdf.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/dcterms.rdf.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/ecrm__110404.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/ecrm__110404.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/ecrm__plus__110404__dw.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/ecrm__plus__110404__dw.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/foaf.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/foaf.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/named_identities.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/named_identities.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/named_identities.pprj.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/named_identities.pprj.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/named_identities.repository.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/named_identities.repository.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/named_identities_test.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/named_identities_test.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/named_identities_test.pprj.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/named_identities_test.pprj.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/named_identities_test.repository.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/named_identities_test.repository.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/openannotation.rdf.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/openannotation.rdf.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/persons_library.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/persons_library.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/persons_library.pprj.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/persons_library.pprj.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/persons_library.repository.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/persons_library.repository.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/rdf-schema.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/rdf-schema.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/skos-owl1-dl.rdf.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/skos-owl1-dl.rdf.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/test.owl.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/test.owl.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/test.repository.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/test.repository.i</locationURI>
+		</link>
+		<link>
+			<name>ontologies/.hg/store/data/~2eproject.i</name>
+			<type>1</type>
+			<locationURI>PARENT-1-PROJECT_LOC/MPIWG-ontologies/.hg/store/data/~2eproject.i</locationURI>
+		</link>
+	</linkedResources>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.core.resources.prefs	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,3 @@
+#Mon Dec 05 18:16:35 CET 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.jdt.core.prefs	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,12 @@
+#Mon Dec 05 17:53:22 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Binary file lib/jena.jar has changed
Binary file lib/log4j-1.2.15.jar has changed
Binary file lib/openrdf-sesame-2.3.2-onejar.jar has changed
Binary file lib/virt_sesame2.jar has changed
Binary file lib/virtjdbc3.jar has changed
Binary file lib/virtjdbc4.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpiwg/itgroup/triplestoremanager/exceptions/TripleStoreHandlerException.java	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,10 @@
+package de.mpiwg.itgroup.triplestoremanager.exceptions;
+
+public class TripleStoreHandlerException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -491859023038922276L;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpiwg/itgroup/triplestoremanager/owl/MetaDataHandler.java	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,287 @@
+package de.mpiwg.itgroup.triplestoremanager.owl;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+import org.openrdf.repository.RepositoryException;
+
+import com.hp.hpl.jena.graph.impl.LiteralLabel;
+import com.hp.hpl.jena.util.FileUtils;
+
+import de.mpiwg.itgroup.triplestoremanager.exceptions.TripleStoreHandlerException;
+
+
+
+import edu.stanford.smi.protege.exception.OntologyLoadException;
+import edu.stanford.smi.protege.storage.xml.XMLString;
+import edu.stanford.smi.protegex.owl.ProtegeOWL;
+import edu.stanford.smi.protegex.owl.jena.JenaOWLModel;
+import edu.stanford.smi.protegex.owl.jena.creator.OwlProjectFromUriCreator;
+import edu.stanford.smi.protegex.owl.model.OWLIndividual;
+import edu.stanford.smi.protegex.owl.model.OWLModel;
+import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
+import edu.stanford.smi.protegex.owl.model.RDFProperty;
+import edu.stanford.smi.protegex.owl.model.RDFResource;
+import edu.stanford.smi.protegex.owl.model.RDFSNamedClass;
+import edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass;
+import edu.stanford.smi.protegex.owl.model.impl.DefaultRDFProperty;
+import edu.stanford.smi.protegex.owl.model.impl.DefaultRDFSNamedClass;
+import edu.stanford.smi.protegex.owl.repository.RepositoryManager;
+import edu.stanford.smi.protegex.owl.repository.impl.LocalFolderRepository;
+import edu.stanford.smi.protegex.owl.ui.profiles.OWLProfiles;
+import edu.stanford.smi.protegex.owl.ui.profiles.ProfilesManager;
+
+public class MetaDataHandler {
+
+	String ontologieUriString = "file:///Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/ontologies/namedIdentities.owl";
+	//String rdfUriString = "file:///Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/ontologies/rdf-schema";
+	String owlFolder = "/Users/dwinter/Documents/Projekte/ECHO-eSciDoc-MPDL/escidocMPIWG/NamedIdentityManager/ontologies";
+
+	static MetaDataHandler instance=null;
+	
+	private JenaOWLModel owlModel;
+
+	public JenaOWLModel getOwlModel() {
+		return owlModel;
+	}
+
+	private Logger logger = Logger.getRootLogger();
+
+	public MetaDataHandler() {
+		try {
+			URI ontologieUri = new URI(ontologieUriString);
+			loadOWL(owlFolder, ontologieUri);
+		} catch (URISyntaxException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+			return;
+		} catch (OntologyLoadException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		logger.info("initialized handler");
+
+	}
+
+//	public JenaOWLModel createMyJenaOWLModelFromURI(String uri) throws OntologyLoadException {
+//	        //Collection errors = new ArrayList();
+//	        OwlProjectFromUriCreator creator = new OwlProjectFromUriCreator();
+//	        creator.setLang(FileUtils.
+//	        creator.setOntologyUri(uri);
+//	        //creator.create(errors);
+//	        JenaOWLModel owlModel = creator.getOwlModel();
+//	        //handleErrors(errors);
+//	        return owlModel;
+//	    }
+	    
+	public void loadOWL(String folder, URI uri) throws OntologyLoadException {
+		//owlModel = ProtegeOWL.createJenaOWLModel();
+		
+		owlModel = ProtegeOWL.createJenaOWLModelFromURI(ontologieUriString);
+		
+		//ProfilesManager.setProfile(owlModel, OWLProfiles.RDFSClass_but_not_OWLClass_Type.getURI());
+		// Load repository
+		RepositoryManager rman = owlModel.getRepositoryManager();
+
+		// Add working directory to repository manager.
+		File workingDirectory = new File(folder);
+		rman.addGlobalRepository(new LocalFolderRepository(workingDirectory));
+		
+		LocalFolderRepository localRepository = new LocalFolderRepository(new File("/tmp"));
+		rman.addProjectRepository(localRepository);
+
+
+
+
+		// Load ontology
+
+		//((JenaOWLModel) owlModel).load(uri, "OWL-FULL");
+	}
+
+	/**
+	 * Gibt alle Properties der Klasse zurueck, d.h. auch diejenigen die inferiert werden.
+	 * @param string
+	 * @return
+	 */
+	public Set getAssociatedPropsForClass(String string) {
+
+	
+
+		OWLNamedClass owlclass;
+		try {
+			owlclass = (OWLNamedClass) owlModel.getOWLNamedClass(string);
+		} catch (Exception e) {
+			logger.debug("Problem getting OWLClass, try RDFS later.");
+			//wenn eine Klasse sowohl eine RDFS als auch per Zuordnung in der Ontologie eine OWL classe ist, wir hier eine Fehler ausgeworfen:
+			//java.lang.ClassCastException: edu.stanford.smi.protegex.owl.model.impl.DefaultRDFSNamedClass cannot be cast to edu.stanford.smi.protegex.owl.model.OWLNamedClass
+			//at edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel.getOWLNamedClass(Unknown Source)
+			owlclass= null;
+		}
+
+		if (owlclass != null) {
+			return owlclass.getAssociatedProperties();
+		} else {
+			logger.debug("Cannot find OWLClass:" + string);
+			logger.debug("Trying RDFSClass");
+			RDFSNamedClass rdfsclass=(RDFSNamedClass)owlModel.getRDFSNamedClass(string);
+			if (rdfsclass != null) {
+				return rdfsclass.getAssociatedProperties();
+			} else {
+				logger.debug("Cannot find RDFSClass:" + string);
+				return null;
+			}
+		}
+
+		
+		
+	}
+	
+	/**
+	 * Gibt alle direkten Properties der angegebenen Klasse zurueck.
+	 * @param string
+	 * @return
+	 */
+	public Collection getDirectPropsForClass(String string, Boolean transitiv) {
+
+		
+
+		OWLNamedClass owlclass;
+		try {
+			owlclass = (OWLNamedClass) owlModel.getOWLNamedClass(string);
+		} catch (Exception e) {
+			logger.debug("Problem getting OWLClass, try RDFS later.");
+			//wenn eine Klasse sowohl eine RDFS als auch per Zuordnung in der Ontologie eine OWL classe ist, wir hier eine Fehler ausgeworfen:
+			//java.lang.ClassCastException: edu.stanford.smi.protegex.owl.model.impl.DefaultRDFSNamedClass cannot be cast to edu.stanford.smi.protegex.owl.model.OWLNamedClass
+			//at edu.stanford.smi.protegex.owl.model.impl.AbstractOWLModel.getOWLNamedClass(Unknown Source)
+			owlclass= null;
+		}
+
+		if (owlclass != null) {
+			return owlclass.getUnionDomainProperties(transitiv);
+		} else {
+			logger.debug("Cannot find OWLClass:" + string);
+			logger.debug("Trying RDFSClass");
+			RDFSNamedClass rdfsclass=(RDFSNamedClass)owlModel.getRDFSNamedClass(string);
+			if (rdfsclass != null) {
+				
+				return rdfsclass.getUnionDomainProperties(transitiv);
+			} else {
+				logger.debug("Cannot find RDFSClass:" + string);
+				return null;
+			}
+		}
+
+		
+		
+	}
+	
+
+	public List<String> getEquivalentClasses(String string) {
+		OWLNamedClass owlclass = (OWLNamedClass) owlModel
+		.getOWLNamedClass(string);
+		
+		List<String> retList = new ArrayList<String>();
+		Collection eqClasses = owlclass.getEquivalentClasses();
+		Iterator it = eqClasses.iterator();
+		while(it.hasNext()){
+			Object cls = it.next();
+			String name = "";
+			if (DefaultOWLNamedClass.class.isInstance(cls)){
+				name=((DefaultOWLNamedClass)cls).getName();
+			} else if (DefaultRDFSNamedClass.class.isInstance(cls)){
+				name=((DefaultRDFSNamedClass)cls).getName();
+			}
+			retList.add(name);
+			
+		}
+		
+		return retList;
+	}
+
+	
+	public static void main(String args[]) throws RepositoryException, TripleStoreHandlerException {
+		TripleStoreHandler th = new TripleStoreHandler("jdbc:virtuoso://virtuoso.mpiwg-berlin.mpg.de:1111", "dba", "dba");
+		MetaDataHandler mh = new MetaDataHandler();
+
+		//Set<DefaultRDFProperty> props= mh.getPropsForClass("http://dbpedia.org/ontology/Person");
+		
+		mh.getEquivalentClasses("http://dbpedia.org/ontology/Person");
+		
+		//Map<String, String> ret = th.getValues(props,"<http://dbpedia.org/resource/Abraham_Lincoln>");
+		
+		//Map<String, String> ret = th.getResources("http://xmlns.com/foaf/0.1/name","Abraham Lincoln","en");
+		//System.out.println(ret);
+	}
+
+	public OWLIndividual generateEntity(String clsName, Map<String, Object> values) {
+		OWLNamedClass owlclass = (OWLNamedClass) owlModel
+		.getOWLNamedClass(clsName);
+		
+		OWLIndividual inst = (OWLIndividual) owlclass.createInstance(null);
+		for(String key:values.keySet()){
+			RDFProperty property =owlModel.getRDFProperty(key); 
+			inst.setPropertyValue(property, values.get(key));
+			
+		
+		}
+		
+		return inst;
+	}
+	
+	public OWLIndividual generateEntity(String clsName, String instanceName) {
+		OWLNamedClass owlclass = (OWLNamedClass) owlModel
+		.getOWLNamedClass(clsName);
+		
+		OWLIndividual inst = (OWLIndividual) owlclass.createInstance(instanceName);
+		
+		
+		return inst;
+	}
+	
+	public OWLIndividual generateEntity(String clsName, String instanceName, Map<String, Object> values) {
+		OWLNamedClass owlclass = (OWLNamedClass) owlModel
+		.getOWLNamedClass(clsName);
+		
+		OWLIndividual inst = (OWLIndividual) owlclass.createInstance(instanceName);
+		
+		for(String key:values.keySet()){
+			RDFProperty property =owlModel.getRDFProperty(key); 
+			inst.setPropertyValue(property, values.get(key));
+			
+		
+		}
+		
+		return inst;
+	}
+
+	public void printIndividual(OWLIndividual ind){
+		 Collection<RDFProperty> props = ind.getRDFProperties();
+		 Iterator<RDFProperty> propsIts = props.iterator();
+		 while(propsIts.hasNext()){
+			 RDFProperty prop = propsIts.next();
+			 System.err.println(prop.getName()+":"+ind.getPropertyValue(prop));
+		 }
+	}
+	
+	public static MetaDataHandler getInstance(){
+		
+		if (instance==null){
+			instance = new MetaDataHandler();
+		}
+		return instance;
+	}
+
+
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpiwg/itgroup/triplestoremanager/owl/TripleStoreHandler.java	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,457 @@
+package de.mpiwg.itgroup.triplestoremanager.owl;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.openrdf.model.Resource;
+import org.openrdf.model.Statement;
+import org.openrdf.model.URI;
+import org.openrdf.model.Value;
+import org.openrdf.model.impl.ContextStatementImpl;
+import org.openrdf.model.impl.LiteralImpl;
+import org.openrdf.query.MalformedQueryException;
+import org.openrdf.query.QueryEvaluationException;
+import org.openrdf.query.QueryLanguage;
+import org.openrdf.query.TupleQuery;
+import org.openrdf.query.TupleQueryResult;
+import org.openrdf.query.impl.DatasetImpl;
+import org.openrdf.repository.Repository;
+import org.openrdf.repository.RepositoryConnection;
+import org.openrdf.repository.RepositoryException;
+import org.openrdf.repository.RepositoryResult;
+import org.openrdf.rio.RDFHandlerException;
+import org.openrdf.rio.rdfxml.RDFXMLWriter;
+
+import virtuoso.sesame2.driver.VirtuosoRepository;
+import de.mpiwg.itgroup.triplestoremanager.exceptions.TripleStoreHandlerException;
+import edu.stanford.smi.protegex.owl.model.OWLIndividual;
+import edu.stanford.smi.protegex.owl.model.OWLModel;
+import edu.stanford.smi.protegex.owl.model.OWLNamedClass;
+import edu.stanford.smi.protegex.owl.model.RDFProperty;
+import edu.stanford.smi.protegex.owl.model.RDFSLiteral;
+import edu.stanford.smi.protegex.owl.model.impl.AbstractRDFSClass;
+import edu.stanford.smi.protegex.owl.model.impl.DefaultRDFProperty;
+
+
+
+public class TripleStoreHandler {
+
+	
+	public static class Quadruple {
+		String subj;
+		String pred;
+		Object obj;
+		String ctx;
+		
+		public String getSubj() {
+			return subj;
+		}
+
+		public String getPred() {
+			return pred;
+		}
+
+		public Object getObj() {
+			return obj;
+		}
+
+		public String getCtx() {
+			return ctx;
+		}
+
+	
+		
+		public Quadruple(String s, String p, String o,String c){
+			subj=s;
+			pred=p;
+			obj=o;
+			ctx=c;
+		}
+		
+		
+		public Quadruple(String s, String p, Value o,String c){
+			subj=s;
+			pred=p;
+			obj=o;
+			ctx=c;
+		}
+		
+		public String toString(){
+			return String.format("%s  %s  %s  %s.", subj,pred,obj,ctx);
+		}
+		
+		
+	}
+	
+	public static class LiteralQuadruple  extends Quadruple{
+		String subj;
+		String pred;
+		Object obj;
+		String ctx;
+			
+		public LiteralQuadruple(String s, String p, String o,String c){
+			super(s,p,o,c);
+			
+			
+		}
+		
+	}
+	public static String ONTOLOGY_NS="http://ontologies.mpiwg-berlin.mpg.de/authorities/namedIdentities/";
+	private boolean save=true; // wenn false dann schreibt write nicht ins repositorium.
+	
+	private Logger logger = Logger.getRootLogger();
+	
+	static  Map<String,TripleStoreHandler> instance = new HashMap<String, TripleStoreHandler>();
+	private Repository repository;
+
+	private int counter=0;
+	public Connection sqlCon;
+	public Repository getRepository() {
+		return repository;
+	}
+	public void setRepository(Repository repository) {
+		this.repository = repository;
+	}
+	public TripleStoreHandler(String url,String username, String password) throws TripleStoreHandlerException {
+		//String sesameUrl="http://127.0.0.1:8180/openrdf-sesame/repositories/authorityDataPersons";
+		//String sesameUrl="http://127.0.0.1:8180/openrdf-sesame/repositories/personsRepository";
+
+		//String sesameUrl="http://127.0.0.1:8180/openrdf-sesame/repositories/swiftowlimTest";
+		//
+		//repository = new HTTPRepository(sesameUrl);
+		
+		
+		repository = new VirtuosoRepository(url, username, password);
+		try {
+			Class.forName("virtuoso.jdbc4.Driver");
+			String connectString = url+"/charset=UTF-8";
+			this.sqlCon = DriverManager.getConnection(connectString, username,
+					password);
+		} catch (Exception e) {
+			throw new TripleStoreHandlerException();
+		}
+	}
+	public Map<String,Object> getJenaRDFValues(Collection props, String identifier, OWLModel model) throws RepositoryException {
+		identifier = identifier.replace("<", "");
+		identifier = identifier.replace(">", "");
+		Map<String,Object> retMap = new HashMap<String, Object>();
+		
+		URI subj= repository.getValueFactory().createURI(identifier);
+		RepositoryConnection con = repository.getConnection();
+		Iterator propsIterator = props.iterator();
+		while(propsIterator.hasNext()){
+		//for(DefaultRDFProperty prop:props){
+			DefaultRDFProperty prop=(DefaultRDFProperty) propsIterator.next();
+			Object newValue;
+			String name=prop.getName();
+			//System.out.println(name);
+			RepositoryResult<Statement> statements = con.getStatements(subj, repository.getValueFactory().createURI(name), null, true);
+			//RepositoryResult<Statement> statements = con.getStatements(subj, null, null, false);
+			//System.out.println(statements);
+			statements.enableDuplicateFilter();
+			while(statements.hasNext()){
+				Statement sm = statements.next();
+				Value val = sm.getObject();
+				if (LiteralImpl.class.isInstance(val)) { // wenn ein
+					// string
+					// literal,
+					// dann
+					// uebersetze
+					// in jena
+					// string
+					// literal
+					LiteralImpl li = (LiteralImpl) val;
+
+					newValue = model.createRDFSLiteralOrString(li.getLabel(),li.getLanguage());
+					} else { // anderfalls erzeuge generische Instance
+						
+						
+						newValue= model.getRDFResource(val.stringValue());
+						
+						if (newValue==null){
+							OWLNamedClass owlclass = (OWLNamedClass) model
+						.getOWLNamedClass("http://www.w3.org/2002/07/owl#Thing");
+						newValue = (OWLIndividual) owlclass.createInstance(val.stringValue());
+						}
+					}	
+				retMap.put(sm.getPredicate().stringValue(), newValue);
+				
+			}
+		}
+		return retMap;
+		
+	}
+	public Map<String,String> getResources(String subj, String pred, String obj, String lang) throws RepositoryException {
+		
+		Map<String,String> retMap = new HashMap<String, String>();
+		RepositoryConnection con = repository.getConnection();
+		RepositoryResult<Statement> statements = con.getStatements(repository.getValueFactory().createURI(subj), repository.getValueFactory().createURI(pred),  repository.getValueFactory().createLiteral(obj, lang), true);
+		statements.enableDuplicateFilter();
+		while(statements.hasNext()){
+			Statement sm = statements.next();
+			retMap.put(sm.getSubject().stringValue(), sm.getObject().stringValue());
+			
+		}
+	
+	return retMap;
+	}
+
+	public TupleQueryResult querySPARQL(String queryString) throws MalformedQueryException, QueryEvaluationException, TripleStoreHandlerException{
+		 TupleQuery tupleQuery;
+		try {
+			tupleQuery = repository.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString);
+		} catch (RepositoryException e) {
+			// possible a time out
+			//wait a bit
+			try {
+				Thread.sleep(10000);
+				//try again
+				tupleQuery = repository.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString);
+			} catch (InterruptedException e1) {
+				e1.printStackTrace();
+				throw new TripleStoreHandlerException();
+			} catch (RepositoryException e2) {
+				try {
+					//ok try ones more
+					Thread.sleep(10000);
+					tupleQuery = repository.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString);
+					} catch (InterruptedException e1) {
+					e1.printStackTrace();
+					throw new TripleStoreHandlerException();
+					} catch (RepositoryException e3) {
+						e.printStackTrace();
+						throw new TripleStoreHandlerException();
+						
+					}
+			}
+		}
+         return tupleQuery.evaluate();
+      
+	}
+	
+	public TupleQueryResult querySPARQL(String queryString,String context) throws RepositoryException, MalformedQueryException, QueryEvaluationException{
+		 TupleQuery tupleQuery = repository.getConnection().prepareTupleQuery(QueryLanguage.SPARQL, queryString);
+		 DatasetImpl ds = new DatasetImpl();
+		 ds.addNamedGraph(createUri(repository,context));
+		 tupleQuery.setDataset(ds);
+        return tupleQuery.evaluate();
+     
+	}
+	public RepositoryResult<Statement> getStatements(String subj,String pred, String obj) throws RepositoryException {
+		RepositoryConnection con = repository.getConnection();
+		
+		RepositoryResult<Statement> statements = con.getStatements(createUri(repository,subj), createUri(repository,pred),  createUri(repository,obj), true);
+		
+	
+	return statements;
+	}
+	
+	public RepositoryResult<Statement> getStatements(String subj,String pred, String obj, String ctx) throws RepositoryException {
+		RepositoryConnection con = repository.getConnection();
+	
+		RepositoryResult<Statement> statements = con.getStatements(createUri(repository,subj), createUri(repository,pred),  createUri(repository,obj), true, createUri(repository, ctx));
+		
+	
+	return statements;
+	}
+	
+	public RepositoryResult<Statement> getStatements(Resource subj,URI pred, Value obj, String ctx) throws RepositoryException {
+		RepositoryConnection con = repository.getConnection();
+		
+		RepositoryResult<Statement> statements = con.getStatements(subj, pred, obj, true, createUri(repository, ctx));
+		
+	
+	return statements;
+	}
+	
+	public URI createUri(String subj){
+		return createUri(repository, subj);
+	}
+	
+	public  Value createLiteral(String subj){
+		return repository.getValueFactory().createLiteral(subj);
+	}
+	
+	public Value createLiteral(String subj, String lang){
+		return repository.getValueFactory().createLiteral(subj,lang);
+	}
+	
+	
+	public static URI createUri(Repository repository2, String subj) {
+		if (subj==null)
+			return null;
+		return repository2.getValueFactory().createURI(subj);
+		
+	}
+	public static Statement getFirstStatement(
+			RepositoryResult<Statement> namesStatements) throws RepositoryException {
+		while(namesStatements.hasNext()){
+			return namesStatements.next();
+		}
+		
+		return null;
+	}
+	public void write(OWLIndividual ent,String ctx) throws RepositoryException, TripleStoreHandlerException {
+		
+		
+		String ident = ent.getURI();
+//		Iterator<Object> types = ent.getRDFTypes().iterator();
+//		
+//		while(types.hasNext()){
+//			
+//			Object typeObj=types.next();
+//			AbstractRDFSClass type = (AbstractRDFSClass)typeObj;
+//			
+//			
+//			write(ident,"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",type.getURI());
+//		}
+		
+		Iterator<RDFProperty> props=ent.getPossibleRDFProperties().iterator();
+		while(props.hasNext()){
+			RDFProperty prop=props.next();
+			Object val = ent.getPropertyValue(prop);
+			if (val==null){ // nicht belegter wert
+				continue;
+			}
+			if (RDFSLiteral.class.isInstance(val)){
+				RDFSLiteral lit = (RDFSLiteral)val;
+				String lang = lit.getLanguage();
+				String litobj = lit.getString();
+				Value newLit=null;
+				if(lang!=null){
+					newLit=repository.getValueFactory().createLiteral((String)lit.getString(), lang);
+				} else {
+						newLit=repository.getValueFactory().createLiteral((String)litobj);
+					
+				
+				} 
+				write(ident, prop.getURI(), newLit, ctx);
+			} else if(OWLIndividual.class.isInstance(val)){
+				OWLIndividual ind = (OWLIndividual)val;
+				write(ident, prop.getURI(), repository.getValueFactory().createURI(ind.getURI()),ctx);
+			} else if (AbstractRDFSClass.class.isInstance(val)){
+				AbstractRDFSClass ind = (AbstractRDFSClass)val;
+				write(ident, prop.getURI(), repository.getValueFactory().createURI(ind.getURI()),ctx);
+			} else if (String.class.isInstance(val)){
+				write(ident, prop.getURI(), repository.getValueFactory().createLiteral((String)val),ctx);
+			} else {
+				//don't now this type
+				throw new TripleStoreHandlerException();
+			}
+			
+		}
+		
+	}
+	public OWLIndividual getProvider(MetaDataHandler mh, String providerUri) throws RepositoryException {
+		RepositoryConnection con = repository.getConnection();
+		URI createURIProvider = repository.getValueFactory().createURI(ONTOLOGY_NS+"NamedEntityProvider");
+		
+		RepositoryResult<Statement> provider = con.getStatements(repository.getValueFactory().createURI(providerUri), repository.getValueFactory().createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), createURIProvider, true);
+		Statement providerStatement = getFirstStatement(provider);
+		if(providerStatement==null) // provider does not exist
+			return null;
+		
+		
+		Map<String, Object> values = getJenaRDFValues(mh.getAssociatedPropsForClass(createURIProvider.stringValue()),providerUri,mh.getOwlModel());
+		OWLIndividual providerEnt = mh.generateEntity(createURIProvider.stringValue(), providerUri,values);
+		
+		return providerEnt;
+	}
+	
+	public void write(String subj, String pred, String obj,String ctx) throws RepositoryException {
+		Value ob;
+		RepositoryConnection con = repository.getConnection();
+		ob=repository.getValueFactory().createURI(obj);
+		Statement statement = new ContextStatementImpl(repository.getValueFactory().createURI(subj), repository.getValueFactory().createURI(pred), ob,repository.getValueFactory().createURI(ctx));
+		logger.debug("Write to triple store:"+subj+":"+pred+":"+obj);
+		logger.debug("Wrote statement:");
+		counter+=1;
+		logger.debug(counter);
+		if (save){
+		con.add(statement);
+		con.commit();
+		con.close();
+		}
+	}
+	
+	public void write(String subj, String pred, Value obj, String ctx) throws RepositoryException {
+		
+		RepositoryConnection con = repository.getConnection();
+		Statement statement = new ContextStatementImpl(repository.getValueFactory().createURI(subj), repository.getValueFactory().createURI(pred), obj,repository.getValueFactory().createURI(ctx));
+		if(LiteralImpl.class.isInstance(obj)){
+			logger.debug("Write to triple store:"+subj+":"+pred+":"+((LiteralImpl)obj).stringValue());
+		} else
+			logger.debug("Write to triple store:"+subj+":"+pred+":"+obj.toString());
+		
+		logger.debug("Wrote statement:");
+		counter+=1;
+		logger.debug(counter);
+		
+		if (save){
+		con.add(statement);
+		con.commit();
+		con.close();
+		}
+	}
+	
+	public void write(Quadruple q) throws RepositoryException{
+		if (LiteralQuadruple.class.isInstance(q)){
+			write(q.getSubj(),q.getPred(),createLiteral((String)q.getObj()),q.getCtx());
+		} else {
+			if (String.class.isInstance(q.getObj())){
+				write(q.getSubj(),q.getPred(),(String)q.getObj(),q.getCtx());}
+			else {
+				write(q.getSubj(),q.getPred(),(Value)q.getObj(),q.getCtx());}
+				
+		}	
+	}	
+
+	public void write(List<Quadruple> annots) throws RepositoryException {
+		for(Quadruple q:annots){
+			write(q);
+		}
+		
+	}
+	public void exportCtx(String ctx, File file) throws RepositoryException, RDFHandlerException, IOException{
+		
+		RepositoryConnection conn = repository.getConnection();
+		OutputStream output = (file != null) ? new FileOutputStream(file) : System.out;
+        
+		RDFXMLWriter rdfxmlfWriter = new RDFXMLWriter(output);
+        //conn.export(rdfxmlfWriter,  repository.getValueFactory().createURI(ctx));
+		conn.exportStatements(null, null, null, true, rdfxmlfWriter, repository.getValueFactory().createURI(ctx));
+        output.write('\n');
+        conn.close();
+	}
+	
+
+	public static void main(String args[]) throws RepositoryException, RDFHandlerException, IOException, TripleStoreHandlerException{
+		TripleStoreHandler th = new TripleStoreHandler("jdbc:virtuoso://virtuoso.mpiwg-berlin.mpg.de:1111", "dba", "dba");
+		//th.exportCtx("http://import", new File("/tmp/out.rdf"));
+		//
+		th.exportCtx("file://out.owl", new File("/tmp/out2.rdf"));
+		
+	}
+	
+	
+	public static TripleStoreHandler getInstance(String url, String user, String password) throws TripleStoreHandlerException{
+		
+		String identString=url+"_"+user+"_"+password;
+		
+		if (instance.get(identString)==null){
+			instance.put(identString,  new TripleStoreHandler(url,user,password));
+		}
+		TripleStoreHandler th= instance.get(identString);
+		return th;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/de/mpiwg/itgroup/triplestoremanager/owl/Util.java	Thu Dec 08 08:50:00 2011 +0100
@@ -0,0 +1,44 @@
+package de.mpiwg.itgroup.triplestoremanager.owl;
+
+import java.util.Map;
+
+import edu.stanford.smi.protegex.owl.model.RDFSLiteral;
+
+public class Util {
+
+	public static String rdf2xml(Map<String, Object> values) {
+		String ret="<properties>\n";
+		for(String tagName:values.keySet()){
+
+			if (RDFSLiteral.class.isInstance(values.get(tagName))){
+				String value = ((RDFSLiteral)values.get(tagName)).getString();
+				String fTagName = rdfPredToTagNS(tagName);
+				ret+=String.format("<%s>%s</%s>\n", fTagName,value,rdfPredToTag(tagName));
+				
+			}
+		}
+		ret+="</properties>";
+		
+		return ret;
+	}
+
+	public static String rdfPredToTagNS (String pred){
+		String[] splitted= pred.split("/|#");
+		String ns="";
+		
+		for (int i=0; i<splitted.length-1;i++){
+			if(i!=0)
+				ns+="/";
+			ns+=splitted[i];
+		}
+		
+		return String.format("%s xmlns=\"%s\"",splitted[splitted.length-1],ns);
+	}
+	
+	public static String rdfPredToTag (String pred){
+		String[] splitted= pred.split("/|#");
+		
+		
+		return splitted[splitted.length-1];
+	}
+}