You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by en...@apache.org on 2011/04/01 14:00:16 UTC
svn commit: r1087665 [1/2] - in /incubator/stanbol/trunk/owl: ./ src/
src/main/ src/main/assembly/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/stanbol/
src/main/java/org/apache/stanbol/owl/ src/main/java/org/apa...
Author: enridaga
Date: Fri Apr 1 12:00:14 2011
New Revision: 1087665
URL: http://svn.apache.org/viewvc?rev=1087665&view=rev
Log:
STANBOL-137 \Adding the owl module
Added:
incubator/stanbol/trunk/owl/ (with props)
incubator/stanbol/trunk/owl/pom.xml
incubator/stanbol/trunk/owl/src/ (with props)
incubator/stanbol/trunk/owl/src/main/ (with props)
incubator/stanbol/trunk/owl/src/main/assembly/ (with props)
incubator/stanbol/trunk/owl/src/main/assembly/felix.xml
incubator/stanbol/trunk/owl/src/main/java/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/apache/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/RunSingleSPARQL.java
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToClerezzaConverter.java
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToOwlConvert.java
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/OWLAPIToClerezzaConverter.java
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/KRFormat.java
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/OWLOntologyWriter.java
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owlapi/ (with props)
incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owlapi/trasformation/ (with props)
incubator/stanbol/trunk/owl/src/main/resources/ (with props)
incubator/stanbol/trunk/owl/src/main/resources/TestFile/ (with props)
incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParent.owl
incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParentRDFXML.owl
incubator/stanbol/trunk/owl/src/main/resources/TestFile/ProvaParent.owl
incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParent.owl
incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParentRDFXML.owl
incubator/stanbol/trunk/owl/src/main/resources/TestFile/catalog.xml
incubator/stanbol/trunk/owl/src/main/resources/owlapi/ (with props)
incubator/stanbol/trunk/owl/src/main/resources/owlapi/owlapi-3.0.0.jar (with props)
incubator/stanbol/trunk/owl/src/test/ (with props)
incubator/stanbol/trunk/owl/src/test/java/ (with props)
incubator/stanbol/trunk/owl/src/test/java/org/ (with props)
incubator/stanbol/trunk/owl/src/test/java/org/apache/ (with props)
incubator/stanbol/trunk/owl/src/test/java/org/apache/stanbol/ (with props)
incubator/stanbol/trunk/owl/src/test/java/org/apache/stanbol/owl/ (with props)
incubator/stanbol/trunk/owl/src/test/java/org/apache/stanbol/owl/RunSingleSPARQLTest.java
incubator/stanbol/trunk/owl/src/test/java/org/apache/stanbol/owl/trasformation/ (with props)
incubator/stanbol/trunk/owl/src/test/java/org/apache/stanbol/owl/trasformation/ConversionTester.java
incubator/stanbol/trunk/owl/src/test/java/org/apache/stanbol/owlapi/ (with props)
incubator/stanbol/trunk/owl/src/test/java/org/apache/stanbol/owlapi/trasformation/ (with props)
Propchange: incubator/stanbol/trunk/owl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Added: incubator/stanbol/trunk/owl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/pom.xml?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/pom.xml (added)
+++ incubator/stanbol/trunk/owl/pom.xml Fri Apr 1 12:00:14 2011
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version
+ 2.0 (the "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.stanbol</groupId>
+ <artifactId>stanbol-parent</artifactId>
+ <version>${stanbol-version}</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+
+ <artifactId>org.apache.stanbol.owl</artifactId>
+ <version>${stanbol-version}</version>
+ <packaging>bundle</packaging>
+ <name>Apache Stanbol OSGi bundle for OWL</name>
+
+ <repositories>
+ <repository>
+ <id>stlab-cnr-repo</id>
+ <url>http://stlab.istc.cnr.it/software/maven/repo</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>owlapi</groupId>
+ <artifactId>owlapi</artifactId>
+ <version>3.0.0</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.5.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.rdf.core</artifactId>
+ <version>0.12-incubating-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.rdf.jena.parser</artifactId>
+ <version>0.10-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.rdf.jena.serializer</artifactId>
+ <version>0.9-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.hp.hpl.jena</groupId>
+ <artifactId>jena</artifactId>
+ <version>2.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.hp.hpl.jena</groupId>
+ <artifactId>arq</artifactId>
+ <version>2.8.3</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ <version>1.1.1</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.rdf.rdfjson</artifactId>
+ <version>0.3-incubating-SNAPSHOT</version>
+ <type>bundle</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>
+ com.hp.hpl.jena.*,
+ org.apache.clerezza.rdf.*,
+ javax.*,
+ org.xml.sax.*,
+ de.uulm.ecs.ai.*,
+ org.semanticweb.owlapi.*,
+ org.coode.*,
+ uk.ac.manchester.cs.*,
+ com.clarkparsia.owlapi.*,
+ org.slf4j.*;version=1.5.2,
+ *
+ </Import-Package>
+ <Export-Package>
+ de.uulm.ecs.ai.*,
+ org.semanticweb.owlapi.*,
+ org.coode.*,
+ uk.ac.manchester.cs.*,
+ com.clarkparsia.owlapi.*,
+ org.apache.stanbol.owl.*;version=${stanbol-version}
+ </Export-Package>
+ <Private-Package />
+ <_nouses>true</_nouses>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <groupId>org.apache.stanbol</groupId>
+</project>
Propchange: incubator/stanbol/trunk/owl/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/assembly/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Added: incubator/stanbol/trunk/owl/src/main/assembly/felix.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/assembly/felix.xml?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/assembly/felix.xml (added)
+++ incubator/stanbol/trunk/owl/src/main/assembly/felix.xml Fri Apr 1 12:00:14 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<assembly>
+ <id>all</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <dependencySets>
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory>modules</outputDirectory>
+ <excludes>
+ <exclude>org.apache.felix:org.apache.felix.main</exclude>
+ </excludes>
+ </dependencySet>
+ <dependencySet>
+ <useProjectArtifact>false</useProjectArtifact>
+ <outputDirectory></outputDirectory>
+ <includes>
+ <include>org.apache.felix:org.apache.felix.main</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+ <files>
+ <file>
+ <source>${project.build.directory}/${project.artifactId}-${project.version}.jar</source>
+ <outputDirectory>modules</outputDirectory>
+ </file>
+ <file>
+ <source>${project.build.directory}/felix.jar</source>
+ <outputDirectory>bin</outputDirectory>
+ </file>
+ <file>
+ <source>${project.build.directory}/config.properties</source>
+ <outputDirectory>conf</outputDirectory>
+ </file>
+ </files>
+</assembly>
Propchange: incubator/stanbol/trunk/owl/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Added: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/RunSingleSPARQL.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/RunSingleSPARQL.java?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/RunSingleSPARQL.java (added)
+++ incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/RunSingleSPARQL.java Fri Apr 1 12:00:14 2011
@@ -0,0 +1,185 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.stanbol.owl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.semanticweb.owlapi.model.OWLOntology;
+
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.query.QueryExecution;
+import com.hp.hpl.jena.query.QueryExecutionFactory;
+import com.hp.hpl.jena.query.ResultSet;
+
+import org.apache.stanbol.owl.trasformation.JenaToOwlConvert;
+
+/**
+ *
+ * @author elvio
+ */
+public class RunSingleSPARQL {
+
+ private OWLOntology owlmodel;
+ private OntModel jenamodel;
+ private HashMap<String,String> sparqlprefix;
+
+ /**
+ * Constructor to create an OWLOntology object where run the SPARQL query.
+ *
+ * @param owl {The OWLOntology to be querying.}
+ */
+ public RunSingleSPARQL(OWLOntology owl){
+ this.owlmodel = owl;
+
+ try{
+ JenaToOwlConvert j2o = new JenaToOwlConvert();
+ this.jenamodel = j2o.ModelOwlToJenaConvert(owlmodel,"RDF/XML");
+ Iterator<String> iter = jenamodel.getNsPrefixMap().keySet().iterator();
+ Map<String, String> map = jenamodel.getNsPrefixMap();
+ this.sparqlprefix = (HashMap<String, String>) map;
+
+ while(iter.hasNext()){
+ String k = iter.next();
+
+ if(!k.isEmpty()){
+ this.sparqlprefix.put(k,"<"+map.get(k)+">");
+ }else{
+ String base = map.get(k);
+ this.sparqlprefix.put("base", "<"+base+">");
+ this.sparqlprefix.remove(k);
+ }
+ }
+
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * Constructor to create an OWLOntology object where run the SPARQL query.
+ *
+ * @param owl {The OWLOntology to be querying}
+ * @param prefix {The map where the keys are the prefix label and the value the IRI of the prefix on the form: http://www.w3.org/2000/01/rdf-schema#.}
+ */
+ public RunSingleSPARQL(OWLOntology owl, HashMap<String,String> prefix){
+ this.owlmodel = owl;
+ JenaToOwlConvert j2o = new JenaToOwlConvert();
+ this.jenamodel = j2o.ModelOwlToJenaConvert(owlmodel,"RDF/XML");
+ Iterator<String> keys = prefix.keySet().iterator();
+ this.sparqlprefix = new HashMap();
+ while(keys.hasNext()){
+ String key = keys.next();
+ String pre = prefix.get(key);
+
+ if(pre.contains("<"))
+ this.sparqlprefix.put(key, pre);
+ else
+ this.sparqlprefix.put(key,"<"+pre+">");
+ }
+ }
+
+ /**
+ * To get the prefix mapping
+ *
+ * @return {Return a prefix mapping.}
+ */
+ public HashMap<String,String> getSPARQLprefix(){
+ return this.sparqlprefix;
+ }
+
+ /**
+ * To add a new prefix.
+ *
+ * @param label {The prefix label}
+ * @param prefix {The new prefix to be added in the form: http://www.w3.org/2000/01/rdf-schema#}.
+ * @return {A boolean that is true if process finish without errors.}
+ */
+ public boolean addSPARQLprefix(String label,String prefix){
+
+ boolean ok = false;
+
+ if(!sparqlprefix.containsKey(label)){
+
+ if(!prefix.contains("<"))
+ sparqlprefix.put(label, "<"+prefix+">");
+ else
+ sparqlprefix.put(label, prefix);
+
+ if(sparqlprefix.containsKey(label))
+ if(sparqlprefix.get(label).contains(prefix))
+ ok = true;
+
+ }else{
+ System.err.println("The prefix with "+label+" already exists. Prefix: "+sparqlprefix.get(label));
+ ok = false;
+ }
+ return ok;
+
+ }
+
+ /**
+ * To remove a prefix with a particular label from the prefix mapping.
+ *
+ * @param label {The label of the prefix to be removed.}
+ * @return {A boolean that is true if process finish without errors.}
+ */
+ public boolean removeSPARQLprefix(String label){
+ boolean ok = false;
+
+ if(sparqlprefix.containsKey(label)){
+
+ sparqlprefix.remove(label);
+ if(!sparqlprefix.containsKey(label))
+ ok = true;
+ else
+ ok = false;
+
+ }else{
+ System.err.println("No prefix with name "+label);
+ ok = false;
+ }
+
+ return ok;
+ }
+
+ /**
+ * To run a SPARQL query
+ *
+ * @param query {The query string without the declaration of the prefixes.}
+ * @return {Return a Jena Result Set Object.}
+ */
+ public ResultSet runSPARQL(String query){
+
+ if(!sparqlprefix.isEmpty()){
+
+ Iterator<String> keys = sparqlprefix.keySet().iterator();
+ String prefix ="";
+ while(keys.hasNext()){
+ String key = keys.next();
+ prefix = prefix+"PREFIX "+key+": "+sparqlprefix.get(key)+"\n";
+ }
+ query = prefix+query;
+
+ try{
+ QueryExecution qexec = QueryExecutionFactory.create(query,jenamodel);
+ ResultSet results = qexec.execSelect();
+
+ return results;
+ }catch (Exception e){
+ e.printStackTrace();
+ return null;
+ }
+ }else{
+ System.err.println("There is not prefix defined in sparqlprefix.");
+ return null;
+ }
+
+ }
+
+}
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Added: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToClerezzaConverter.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToClerezzaConverter.java?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToClerezzaConverter.java (added)
+++ incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToClerezzaConverter.java Fri Apr 1 12:00:14 2011
@@ -0,0 +1,130 @@
+package org.apache.stanbol.owl.trasformation;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.Triple;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
+import org.apache.clerezza.rdf.core.serializedform.SerializingProvider;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
+import org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider;
+
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+
+/**
+ * This class provides static methods to convert:
+ *
+ * <ul>
+ * <li> a Jena Model (see {@link Model}) to a list of Clerezza triples (see {@link Triple})
+ * <li> a Jena Model to a Clerezza MGraph (see {@link MGraph})
+ * <li> a Clerezza MGraph a Jena Model
+ * <li> a Clerezza MGraph a Jena Graph (see {@link Graph}}
+ * </ul>
+ *
+ *
+ * @author andrea.nuzzolese
+ *
+ */
+
+public class JenaToClerezzaConverter {
+
+
+ /**
+ *
+ * Converts a Jena {@link Model} to an {@link ArrayList} of Clerezza triples (instances of class {@link Triple}).
+ *
+ * @param model {@link Model}
+ * @return an {@link ArrayList} that contains the generated Clerezza triples (see {@link Triple})
+ */
+ public static ArrayList<Triple> jenaModelToClerezzaTriples(Model model){
+
+ ArrayList<Triple> clerezzaTriples = new ArrayList<Triple>();
+
+ MGraph mGraph = jenaModelToClerezzaMGraph(model);
+
+ Iterator<Triple> tripleIterator = mGraph.iterator();
+ while(tripleIterator.hasNext()){
+ Triple triple = tripleIterator.next();
+ clerezzaTriples.add(triple);
+ }
+
+ return clerezzaTriples;
+
+ }
+
+ /**
+ *
+ * Converts a Jena {@link Model} to Clerezza {@link MGraph}.
+ *
+ * @param model {@link Model}
+ * @return the equivalent Clerezza {@link MGraph}.
+ */
+
+ public static MGraph jenaModelToClerezzaMGraph(Model model){
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ model.write(out);
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ ParsingProvider parser = new JenaParserProvider();
+
+ MGraph mGraph = new SimpleMGraph();
+ parser.parse(mGraph,in, SupportedFormat.RDF_XML, null);
+
+ return mGraph;
+
+ }
+
+
+ /**
+ * Converts a Clerezza {@link MGraph} to a Jena {@link Model}.
+ *
+ * @param mGraph {@link MGraph}
+ * @return the equivalent Jena {@link Model}.
+ */
+ public static Model clerezzaMGraphToJenaModel(MGraph mGraph){
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ SerializingProvider serializingProvider = new JenaSerializerProvider();
+
+ serializingProvider.serialize(out, mGraph, SupportedFormat.RDF_XML);
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ Model jenaModel = ModelFactory.createDefaultModel();
+
+ jenaModel.read(in, null);
+
+ return jenaModel;
+
+ }
+
+
+ /**
+ * Converts a Clerezza {@link MGraph} to a Jena {@link Graph}.
+ *
+ * @param mGraph {@link MGraph}
+ * @return the equivalent Jena {@link Graph}.
+ */
+ public static com.hp.hpl.jena.graph.Graph clerezzaMGraphToJenaGraph(MGraph mGraph){
+
+ Model jenaModel = clerezzaMGraphToJenaModel(mGraph);
+ if(jenaModel != null){
+ return jenaModel.getGraph();
+ }
+ else{
+ return null;
+ }
+
+ }
+
+}
Added: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToOwlConvert.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToOwlConvert.java?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToOwlConvert.java (added)
+++ incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/JenaToOwlConvert.java Fri Apr 1 12:00:14 2011
@@ -0,0 +1,709 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.apache.stanbol.owl.trasformation;
+
+
+import com.hp.hpl.jena.ontology.AnnotationProperty;
+import com.hp.hpl.jena.ontology.DatatypeProperty;
+import com.hp.hpl.jena.ontology.ObjectProperty;
+import com.hp.hpl.jena.ontology.OntClass;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.Statement;
+import com.hp.hpl.jena.rdf.model.StmtIterator;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
+import java.util.Set;
+import org.coode.owlapi.turtle.TurtleOntologyFormat;
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.io.RDFXMLOntologyFormat;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom;
+import org.semanticweb.owlapi.model.OWLAnnotationAxiom;
+import org.semanticweb.owlapi.model.OWLAnnotationProperty;
+import org.semanticweb.owlapi.model.OWLAxiom;
+import org.semanticweb.owlapi.model.OWLClass;
+import org.semanticweb.owlapi.model.OWLClassAxiom;
+import org.semanticweb.owlapi.model.OWLDataFactory;
+import org.semanticweb.owlapi.model.OWLDataProperty;
+import org.semanticweb.owlapi.model.OWLDataPropertyAxiom;
+import org.semanticweb.owlapi.model.OWLDatatype;
+import org.semanticweb.owlapi.model.OWLDatatypeDefinitionAxiom;
+import org.semanticweb.owlapi.model.OWLDeclarationAxiom;
+import org.semanticweb.owlapi.model.OWLEntity;
+import org.semanticweb.owlapi.model.OWLIndividualAxiom;
+import org.semanticweb.owlapi.model.OWLNamedIndividual;
+import org.semanticweb.owlapi.model.OWLObjectProperty;
+import org.semanticweb.owlapi.model.OWLObjectPropertyAxiom;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.semanticweb.owlapi.model.OWLOntologyFormat;
+import org.semanticweb.owlapi.model.OWLOntologyID;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.semanticweb.owlapi.model.OWLOntologyStorageException;
+import org.semanticweb.owlapi.util.OWLOntologyMerger;
+
+/**
+ *
+ * @author elvio
+ * @author andrea.nuzzolese
+ */
+public class JenaToOwlConvert {
+
+ private boolean available = true;
+ private boolean availablemain = true;
+ public JenaToOwlConvert(){}
+
+////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////FUNCTIONS/////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+
+ /**
+ * This function converts an ontology object from Jena to OWLapi
+ *
+ * @param jenamodel {An OntModel object}
+ * @param format {only in "RDF/XML"}
+ * @return {An OWLOntology that is an owl object}
+ */
+public synchronized OWLOntology ModelJenaToOwlConvert(Model jenamodel,String format){
+
+ while (availablemain == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ModelJenaToOwlConvert::: "+e);}
+ }
+
+ availablemain=false;
+
+ try{
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ if(!format.equals("RDF/XML")){
+ System.err.println("The only format supported is RDF/XML. Please check the format!");
+
+ availablemain = true;
+ notifyAll();
+ return null;
+ }else{
+
+ jenamodel.write(out,format);
+
+ OWLOntologyManager owlmanager = OWLManager.createOWLOntologyManager();
+
+ OWLOntology owlmodel = owlmanager.loadOntologyFromOntologyDocument(new ByteArrayInputStream(out.toByteArray()));
+
+ availablemain = true;
+ notifyAll();
+ return owlmodel;
+ }}catch (OWLOntologyCreationException eoc){
+ System.err.print("ModelJenaToOwlConvert::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+}
+
+
+/**
+ * This function converts an ontology object from Jena to OWLapi
+ *
+ * @param jenamodel {An OntModel object}
+ * @param format {only in "RDF/XML"}
+ * @return {An OWLOntology that is an owl object}
+ */
+public synchronized OWLOntology ModelJenaToOwlConvert(IRI ontologyIRI, Model jenamodel,String format){
+
+ while (availablemain == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ModelJenaToOwlConvert::: "+e);}
+ }
+
+ availablemain=false;
+
+ try{
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ if(!format.equals("RDF/XML")){
+ System.err.println("The only format supported is RDF/XML. Please check the format!");
+
+ availablemain = true;
+ notifyAll();
+ return null;
+ }else{
+
+ jenamodel.write(out,format);
+
+ OWLOntologyManager owlmanager = OWLManager.createOWLOntologyManager();
+
+ owlmanager.loadOntologyFromOntologyDocument(new ByteArrayInputStream(out.toByteArray()));
+
+ OWLOntologyMerger merger = new OWLOntologyMerger(owlmanager);
+
+ OWLOntology ontology = merger.createMergedOntology(owlmanager, ontologyIRI);
+
+ availablemain = true;
+ notifyAll();
+ return ontology;
+ }}catch (OWLOntologyCreationException eoc){
+ System.err.print("ModelJenaToOwlConvert::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts an ontology object from OWLapi to Jena
+ *
+ * @param owlmodel {An OWLOntology object}
+ * @param format {RDF/XML or TURTLE}
+ * @return {An OntModel that is a Jena object}
+ */
+public synchronized OntModel ModelOwlToJenaConvert(OWLOntology owlmodel,String format){
+
+ while (availablemain == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ModelOwlToJenaConvert::: "+e);}
+ }
+
+ availablemain=false;
+ OWLOntologyID id;
+
+ try{
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ OWLOntologyManager owlmanager = owlmodel.getOWLOntologyManager();
+
+ format = format.trim();
+
+ if(format.equals("TURTLE")||format.equals("RDF/XML")){
+
+ if(format.equals("TURTLE"))
+ owlmanager.setOntologyFormat(owlmodel, new TurtleOntologyFormat());
+ if(format.equals("RDF/XML"))
+ owlmanager.setOntologyFormat(owlmodel,new RDFXMLOntologyFormat());
+
+ OWLOntologyFormat owlformat = owlmanager.getOntologyFormat(owlmodel);
+
+ owlmanager.saveOntology(owlmodel, owlformat, out);
+
+ OntModel jenamodel = ModelFactory.createOntologyModel();
+ id = owlmodel.getOntologyID();
+ jenamodel.read(new ByteArrayInputStream(out.toByteArray()),id.toString().replace("<","").replace(">",""),format);
+
+ availablemain = true;
+ notifyAll();
+ return jenamodel;
+ }else{
+ System.err.println("The only format supported is RDF/XML or TURTLE. Please check the format!");
+
+ availablemain = true;
+ notifyAll();
+ return null;
+ }}catch (OWLOntologyStorageException eos){
+ System.err.print("ModelOwlToJenaConvert::: ");
+ eos.printStackTrace();
+ return null;
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+
+/**
+ * This function converts every statments relative to a resource in an a set of OWLAxiom objects
+ *
+ * @param jenadata {A resource in the form (S,P,O), it could be any kind of resource (a class, a data property, an object property and an instance) except a litteral}
+ * @param format {The format of the ontology, i.e. "RDF/XML"}
+ * @return {A set of axiom in the form of Set<OWLAxiom>}
+ */
+public synchronized Set<OWLAxiom> ResourceJenaToOwlAxiom(Resource jenadata,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ResourceJenaToOwlAxiom::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OntModel model = ModelFactory.createOntologyModel();
+
+ StmtIterator prop = jenadata.listProperties();
+
+ while(prop.hasNext()){
+ Statement stat = prop.nextStatement();
+ model.add(stat);
+ RDFNode obj = stat.getObject();
+ if(obj.isResource()){
+ if(!obj.isURIResource()){
+ StmtIterator aux = ((Resource) obj).listProperties();
+ while(aux.hasNext()){
+ Statement stataux = aux.nextStatement();
+ model.add(stataux);
+ }
+ }
+ }
+ }
+
+ OWLOntology owlmodel = ModelJenaToOwlConvert(model,format);
+
+ available = true;
+ notifyAll();
+ return owlmodel.getAxioms();
+ }catch (Exception e){
+ System.err.print("ResourceJenaToOwlAxiom::: ");
+ e.printStackTrace();
+ return null;
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a set of OWLAxiom in an iterator over jena statements
+ *
+ * @param axioms {A set of aximos}
+ * @param format {RDF/XML or TURTLE}
+ * @return {An iterator over statments}
+ */
+public synchronized StmtIterator AxiomOwlToJenaResource(Set<OWLAxiom> axioms,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("AxiomOwlToJenaResource::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+ OWLOntology ontology = manager.createOntology(IRI.create("http://www.semanticweb.org/owlapi/ontologies/ontology"));
+
+ Iterator<OWLAxiom> axiom = axioms.iterator();
+
+ while(axiom.hasNext())
+ manager.addAxiom(ontology,axiom.next());
+
+ OntModel jenamodel = ModelOwlToJenaConvert(ontology, format);
+
+ available = true;
+ notifyAll();
+ return jenamodel.listStatements();
+ }catch (OWLOntologyCreationException eoc){
+ System.err.print("AxiomOwlToJenaResource::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+
+ }
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts any thingths relatives to an OWL entity in an iterator over Jena statement
+ *
+ * @param entity {It could be a class, an object property or a data property}
+ * @param owlmodel {OWLOntology model where to retrieve information about the entity}
+ * @param format {RDF/XML or TURTLE}
+ * @return {An iterator over jena statement}
+ */
+public synchronized StmtIterator EntityOwlToJenaResource(OWLEntity entity,OWLOntology owlmodel,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("EntityOwlToJenaResource::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+ OWLOntology ontology = manager.createOntology(IRI.create("http://www.semanticweb.org/owlapi/ontologies/ontology"));
+
+ //If the entity is a class
+ if(entity.isOWLClass()){
+ OWLClass owldata = entity.asOWLClass();
+
+ Iterator<OWLClassAxiom> entityaxiom = owlmodel.getAxioms(owldata).iterator();
+
+ while(entityaxiom.hasNext())
+ manager.addAxiom(ontology,entityaxiom.next());
+
+ Iterator<OWLAnnotationAssertionAxiom> annotations = entity.getAnnotationAssertionAxioms(owlmodel).iterator();
+
+ while(annotations.hasNext())
+ manager.addAxiom(ontology,annotations.next());
+ }
+
+ //If the entity is a data property
+ if(entity.isOWLDataProperty()){
+ OWLDataProperty owldata = entity.asOWLDataProperty();
+
+ Iterator<OWLDataPropertyAxiom> entityaxiom = owlmodel.getAxioms(owldata).iterator();
+
+ while(entityaxiom.hasNext())
+ manager.addAxiom(ontology,entityaxiom.next());
+
+ Iterator<OWLAnnotationAssertionAxiom> annotations = entity.getAnnotationAssertionAxioms(owlmodel).iterator();
+
+ while(annotations.hasNext())
+ manager.addAxiom(ontology,annotations.next());
+ }
+
+ //If the entity is an object property
+ if(entity.isOWLObjectProperty()){
+ OWLObjectProperty owldata = entity.asOWLObjectProperty();
+
+ Iterator<OWLObjectPropertyAxiom> entityaxiom = owlmodel.getAxioms(owldata).iterator();
+
+ while(entityaxiom.hasNext())
+ manager.addAxiom(ontology,entityaxiom.next());
+
+ Iterator<OWLAnnotationAssertionAxiom> annotations = entity.getAnnotationAssertionAxioms(owlmodel).iterator();
+
+ while(annotations.hasNext())
+ manager.addAxiom(ontology,annotations.next());
+ }
+
+ //If the entity is a data type
+ if(entity.isOWLDatatype()){
+ OWLDatatype owldata = entity.asOWLDatatype();
+
+ Iterator<OWLDatatypeDefinitionAxiom> entityaxiom = owlmodel.getAxioms(owldata).iterator();
+
+ while(entityaxiom.hasNext())
+ manager.addAxiom(ontology,entityaxiom.next());
+
+ Iterator<OWLAnnotationAssertionAxiom> annotations = entity.getAnnotationAssertionAxioms(owlmodel).iterator();
+
+ while(annotations.hasNext())
+ manager.addAxiom(ontology,annotations.next());
+ }
+
+ //If the entity is an individual
+ if(entity.isOWLNamedIndividual()){
+ OWLNamedIndividual owldata = entity.asOWLNamedIndividual();
+
+ Iterator<OWLIndividualAxiom> entityaxiom = owlmodel.getAxioms(owldata).iterator();
+
+ while(entityaxiom.hasNext())
+ manager.addAxiom(ontology,entityaxiom.next());
+
+ Iterator<OWLAnnotationAssertionAxiom> annotations = entity.getAnnotationAssertionAxioms(owlmodel).iterator();
+
+ while(annotations.hasNext())
+ manager.addAxiom(ontology,annotations.next());
+ }
+
+ //If the entity is an annotations property
+ if(entity.isOWLAnnotationProperty()){
+ OWLAnnotationProperty owldata = entity.asOWLAnnotationProperty();
+
+ Iterator<OWLAnnotationAxiom> entityaxiom = owlmodel.getAxioms(owldata).iterator();
+
+ while(entityaxiom.hasNext())
+ manager.addAxiom(ontology,entityaxiom.next());
+
+ Iterator<OWLAnnotationAssertionAxiom> annotations = entity.getAnnotationAssertionAxioms(owlmodel).iterator();
+
+ while(annotations.hasNext())
+ manager.addAxiom(ontology,annotations.next());
+ }
+
+ OntModel ontmodel = ModelOwlToJenaConvert(ontology, format);
+ StmtIterator statement = ontmodel.listStatements();
+
+ available = true;
+ notifyAll();
+ return statement;
+ }catch (OWLOntologyCreationException eoc){
+ System.err.print("EntityOwlToJenaResource::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a single OntClass of Jena to an OWLClass of OWLAPI
+ *
+ * @param jenadata {Jena class object}
+ * @param format {RDF/XML}
+ * @return {An OWLclass}
+ */
+public synchronized OWLClass ClassJenaToOwl(OntClass jenadata,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ClassJenaToOwl::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OntModel model = ModelFactory.createOntologyModel();
+
+ model.createClass(jenadata.getURI());
+
+ OWLOntology owlmodel = ModelJenaToOwlConvert(model,format);
+
+ available = true;
+ notifyAll();
+ return owlmodel.getClassesInSignature().iterator().next();
+ }catch (Exception e){
+ System.err.print("ClassJenaToOwl::: ");
+ e.printStackTrace();
+ return null;
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a single OWLClass of OWLAPI to an OntClass of Jena
+ *
+ * @param data {An OWLClass}
+ * @param format {RDF/XML or TURTLE}
+ * @return {An OntClass}
+ */
+public synchronized OntClass ClassOwlToJena(OWLClass data,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ClassOwlToJena::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+ OWLOntology ontology = manager.createOntology(IRI.create("http://www.semanticweb.org/owlapi/ontologies/ontology"));
+
+ OWLDataFactory factory = manager.getOWLDataFactory();
+ OWLDeclarationAxiom declarationAxiom = factory.getOWLDeclarationAxiom(data);
+ manager.addAxiom(ontology, declarationAxiom);
+
+ OntModel jenamodel = ModelOwlToJenaConvert(ontology, format);
+
+ available = true;
+ notifyAll();
+ return jenamodel.getOntClass(data.getIRI().toString());
+ }catch (OWLOntologyCreationException eoc){
+ System.err.print("ClassOwlToJena::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a single ObjectProperty of Jena to an OWLObjectProperty of OWLAPI
+ *
+ * @param jenadata {Jena ObjectProperty object}
+ * @param format {RDF/XML}
+ * @return {An OWLObjectProperty}
+ */
+public synchronized OWLObjectProperty ObjPropJenaToOwl(ObjectProperty jenadata,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ClassOwlToJena::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OntModel model = ModelFactory.createOntologyModel();
+
+ model.createObjectProperty(jenadata.getURI());
+
+ OWLOntology owlmodel = ModelJenaToOwlConvert(model,format);
+
+ available = true;
+ notifyAll();
+ return owlmodel.getObjectPropertiesInSignature().iterator().next();
+ }catch (Exception e){
+ System.err.print("ClassOwlToJena::: ");
+ e.printStackTrace();
+ return null;
+ }
+
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a single OWLObjectProperty of owl to an ObjectProperty of Jena
+ *
+ * @param data {An OWLObjectProperty object}
+ * @param format {RDF/XML or TURTLE}
+ * @return {An ObjectProperty}
+ */
+
+public synchronized ObjectProperty ObjPropOwlToJena(OWLObjectProperty data,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("ObjPropOwlToJena::: "+e);}
+ }
+
+ available=false;
+try{
+ OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+ OWLOntology ontology = manager.createOntology(IRI.create("http://www.semanticweb.org/owlapi/ontologies/ontology"));
+
+ OWLDataFactory factory = manager.getOWLDataFactory();
+ OWLDeclarationAxiom declarationAxiom = factory.getOWLDeclarationAxiom(data);
+ manager.addAxiom(ontology, declarationAxiom);
+
+ OntModel jenamodel = ModelOwlToJenaConvert(ontology, format);
+
+ available = true;
+ notifyAll();
+ return jenamodel.getObjectProperty(data.getIRI().toString());
+ }catch (OWLOntologyCreationException eoc){
+ System.err.print("ObjPropOwlToJena::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a DatatypeProperty of Jena to and OWLDataProperty of owl
+ *
+ * @param jenadata {Jena DatatypeProperty object}
+ * @param format {RDF/XML}
+ * @return {An OWLDataProperty}
+ */
+public synchronized OWLDataProperty DataPropJenaToOwl(DatatypeProperty jenadata,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("DataPropJenaToOwl::: "+e);}
+ }
+
+ available=false;
+ try{
+ OntModel model = ModelFactory.createOntologyModel();
+
+ model.createDatatypeProperty(jenadata.getURI());
+
+ OWLOntology owlmodel = ModelJenaToOwlConvert(model,format);
+
+ available = true;
+ notifyAll();
+ return owlmodel.getDataPropertiesInSignature().iterator().next();
+ }catch (Exception e){
+ System.err.print("DataPropJenaToOwl::: ");
+ e.printStackTrace();
+ return null;
+ }
+
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a single OWLDataProperty of OWL to DatatypeProperty of Jena
+ *
+ * @param data {An OWLDataProperty object}
+ * @param format {RDF/XML or TURTLE}
+ * @return {A DatatypeProperty object}
+ */
+public synchronized DatatypeProperty DataPropOwlToJena(OWLDataProperty data,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("DataPropOwlToJena::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+ OWLOntology ontology = manager.createOntology(IRI.create("http://www.semanticweb.org/owlapi/ontologies/ontology"));
+
+ OWLDataFactory factory = manager.getOWLDataFactory();
+ OWLDeclarationAxiom declarationAxiom = factory.getOWLDeclarationAxiom(data);
+ manager.addAxiom(ontology, declarationAxiom);
+
+ OntModel jenamodel = ModelOwlToJenaConvert(ontology, format);
+
+ available = true;
+ notifyAll();
+ return jenamodel.getDatatypeProperty(data.getIRI().toString());
+ }catch (OWLOntologyCreationException eoc){
+ System.err.print("DataPropOwlToJena::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a single AnnotationProperty of Jena to an OWLAnnotationProperty of OWL
+ *
+ * @param jenadata {Jena DatatypeProperty object}
+ * @param format {RDF/XML}
+ * @return {An OWLAnnotationProperty object}
+ */
+
+public synchronized OWLAnnotationProperty AnnotationPropJenaToOwl(AnnotationProperty jenadata,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("AnnotationPropJenaToOwl::: "+e);}
+ }
+
+ available=false;
+ try{
+ OntModel model = ModelFactory.createOntologyModel();
+
+ model.createAnnotationProperty(jenadata.getURI());
+
+ OWLOntology owlmodel = ModelJenaToOwlConvert(model,format);
+
+ available = true;
+ notifyAll();
+ return owlmodel.getAnnotationPropertiesInSignature().iterator().next();
+ }catch (Exception e){
+ System.err.print("AnnotationPropJenaToOwl::: ");
+ e.printStackTrace();
+ return null;
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * This function converts a single OWLAnnotationProperty of OWL to an AnnotationProperty of Jena
+ *
+ * @param data {An OWLAnnotationProperty object}
+ * @param format {RDF/XML or TURTLE}
+ * @return {An AnnotationProperty object}
+
+ */
+public synchronized AnnotationProperty AnnotationPropOwlToJena(OWLAnnotationProperty data,String format){
+
+ while (available == false) {
+ try {wait();} catch (InterruptedException e) {System.err.println("AnnotationPropOwlToJena::: "+e);}
+ }
+
+ available=false;
+
+ try{
+ OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+ OWLOntology ontology = manager.createOntology(IRI.create("http://www.semanticweb.org/owlapi/ontologies/ontology"));
+
+ OWLDataFactory factory = manager.getOWLDataFactory();
+ OWLDeclarationAxiom declarationAxiom = factory.getOWLDeclarationAxiom(data);
+ manager.addAxiom(ontology, declarationAxiom);
+
+ OntModel jenamodel = ModelOwlToJenaConvert(ontology, format);
+
+ available = true;
+ notifyAll();
+ return jenamodel.getAnnotationProperty(data.getIRI().toString());
+ }catch (OWLOntologyCreationException eoc){
+ System.err.print("AnnotationPropOwlToJena::: ");
+ eoc.printStackTrace();
+ return null;
+ }
+}
+////////////////////////////////////////////////////////////////////////////////
+
+}
+
Added: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/OWLAPIToClerezzaConverter.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/OWLAPIToClerezzaConverter.java?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/OWLAPIToClerezzaConverter.java (added)
+++ incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/trasformation/OWLAPIToClerezzaConverter.java Fri Apr 1 12:00:14 2011
@@ -0,0 +1,169 @@
+package org.apache.stanbol.owl.trasformation;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.clerezza.rdf.core.BNode;
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.PlainLiteral;
+import org.apache.clerezza.rdf.core.Triple;
+import org.apache.clerezza.rdf.core.TypedLiteral;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.rdf.core.serializedform.Parser;
+import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SerializingProvider;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
+import org.apache.clerezza.rdf.jena.serializer.JenaSerializerProvider;
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.io.RDFXMLOntologyFormat;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.semanticweb.owlapi.model.OWLOntologyFactory;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.semanticweb.owlapi.model.OWLOntologyStorageException;
+import org.w3c.dom.Document;
+
+import com.hp.hpl.jena.datatypes.BaseDatatype;
+import com.hp.hpl.jena.graph.Graph;
+import com.hp.hpl.jena.ontology.OntModel;
+import com.hp.hpl.jena.rdf.arp.impl.ANode;
+import com.hp.hpl.jena.rdf.model.Literal;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.rdf.model.Property;
+import com.hp.hpl.jena.rdf.model.RDFNode;
+import com.hp.hpl.jena.rdf.model.Resource;
+import com.hp.hpl.jena.rdf.model.Statement;
+import com.hp.hpl.jena.rdf.model.StmtIterator;
+import com.hp.hpl.jena.rdf.model.impl.RDFWriterFImpl;
+import com.hp.hpl.jena.util.FileManager;
+
+
+/**
+ * This class provides static methods to convert:
+ *
+ * <ul>
+ * <li> a Jena Model (see {@link Model}) to a list of Clerezza triples (see {@link Triple})
+ * <li> a Jena Model to a Clerezza MGraph (see {@link MGraph})
+ * <li> a Clerezza MGraph a Jena Model
+ * <li> a Clerezza MGraph a Jena Graph (see {@link Graph}}
+ * </ul>
+ *
+ *
+ * @author andrea.nuzzolese
+ *
+ */
+
+public class OWLAPIToClerezzaConverter {
+
+
+ /**
+ *
+ * Converts an OWL API {@link OWLOntology} to an {@link ArrayList} of Clerezza triples (instances of class {@link Triple}).
+ *
+ * @param ontology {@link OWLOntology}
+ * @return an {@link ArrayList} that contains the generated Clerezza triples (see {@link Triple})
+ */
+ public static ArrayList<Triple> owlOntologyToClerezzaTriples(OWLOntology ontology){
+
+ ArrayList<Triple> clerezzaTriples = new ArrayList<Triple>();
+
+ MGraph mGraph = owlOntologyToClerezzaMGraph(ontology);
+
+ Iterator<Triple> tripleIterator = mGraph.iterator();
+ while(tripleIterator.hasNext()){
+ Triple triple = tripleIterator.next();
+ clerezzaTriples.add(triple);
+ }
+
+ return clerezzaTriples;
+
+ }
+
+
+
+
+
+ /**
+ *
+ * Converts a OWL API {@link OWLOntology} to Clerezza {@link MGraph}.
+ *
+ * @param ontology {@link OWLOntology}
+ * @return the equivalent Clerezza {@link MGraph}.
+ */
+
+ public static MGraph owlOntologyToClerezzaMGraph(OWLOntology ontology){
+
+ MGraph mGraph = null;
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ OWLOntologyManager manager = ontology.getOWLOntologyManager();
+
+ try {
+ manager.saveOntology(ontology, new RDFXMLOntologyFormat(), out);
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ ParsingProvider parser = new JenaParserProvider();
+ mGraph = new SimpleMGraph();
+ parser.parse(mGraph, in, SupportedFormat.RDF_XML, null);
+ } catch (OWLOntologyStorageException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return mGraph;
+
+ }
+
+
+ /**
+ * Converts a Clerezza {@link MGraph} to an OWL API {@link OWLOntology}.
+ *
+ * @param mGraph {@link MGraph}
+ * @return the equivalent OWL API {@link OWLOntology}.
+ */
+ public static OWLOntology clerezzaMGraphToOWLOntology(MGraph mGraph){
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+ SerializingProvider serializingProvider = new JenaSerializerProvider();
+
+ serializingProvider.serialize(out, mGraph, SupportedFormat.RDF_XML);
+
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+ OWLOntology ontology = null;
+ try {
+ ontology = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(in);
+ } catch (OWLOntologyCreationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ return ontology;
+
+ }
+
+
+
+
+}
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Added: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/KRFormat.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/KRFormat.java?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/KRFormat.java (added)
+++ incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/KRFormat.java Fri Apr 1 12:00:14 2011
@@ -0,0 +1,38 @@
+package org.apache.stanbol.owl.web;
+
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Additional MIME types for knowledge representation formats.
+ *
+ * @author andrea.nuzzolese
+ * @author alessandro
+ *
+ */
+public class KRFormat extends MediaType {
+
+ public static final String RDF_XML = "application/rdf+xml";
+
+ public static final MediaType RDF_XML_TYPE = new MediaType("application", "rdf+xml");
+
+ public static final String OWL_XML = "application/owl+xml";
+
+ public static final MediaType OWL_XML_TYPE = new MediaType("application", "owl+xml");
+
+ public static final String MANCHESTER_OWL = "application/manchester+owl";
+
+ public static final MediaType MANCHESTER_OWL_TYPE = new MediaType("application", "manchester+xml");
+
+ public static final String FUNCTIONAL_OWL = "application/functional+owl";
+
+ public static final MediaType FUNCTIONAL_OWL_TYPE = new MediaType("application", "functional+xml");
+
+ public static final String TURTLE = "application/turtle";
+
+ public static final MediaType TURTLE_TYPE = new MediaType("application", "turtle");
+
+ public static final String RDF_JSON = "application/rdf+json";
+
+ public static final MediaType RDF_JSON_TYPE = new MediaType("application", "rdf+json");
+
+}
Added: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/OWLOntologyWriter.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/OWLOntologyWriter.java?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/OWLOntologyWriter.java (added)
+++ incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owl/web/OWLOntologyWriter.java Fri Apr 1 12:00:14 2011
@@ -0,0 +1,126 @@
+package org.apache.stanbol.owl.web;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Provider;
+
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
+import org.apache.clerezza.rdf.rdfjson.serializer.RdfJsonSerializingProvider;
+import org.coode.owlapi.manchesterowlsyntax.ManchesterOWLSyntaxOntologyFormat;
+import org.coode.owlapi.turtle.TurtleOntologyFormat;
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.io.OWLFunctionalSyntaxOntologyFormat;
+import org.semanticweb.owlapi.io.OWLXMLOntologyFormat;
+import org.semanticweb.owlapi.io.RDFXMLOntologyFormat;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.semanticweb.owlapi.model.OWLOntologyStorageException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.stanbol.owl.trasformation.OWLAPIToClerezzaConverter;
+
+@Provider
+@Produces( { KRFormat.RDF_XML, KRFormat.OWL_XML, KRFormat.MANCHESTER_OWL,
+ KRFormat.FUNCTIONAL_OWL, KRFormat.TURTLE, KRFormat.RDF_JSON })
+public class OWLOntologyWriter implements MessageBodyWriter<OWLOntology> {
+
+ protected Serializer serializer;
+
+ protected ServletContext servletContext;
+
+ public OWLOntologyWriter(@Context ServletContext servletContext) {
+ Logger log = LoggerFactory.getLogger(getClass());
+ this.servletContext = servletContext;
+ log.info("Setting context to " + servletContext);
+ serializer = (Serializer) this.servletContext
+ .getAttribute(Serializer.class.getName());
+ if (serializer == null) {
+ log.info("Serializer not found in Servlet context.");
+ serializer = new Serializer();
+ }
+ }
+
+ @Override
+ public long getSize(OWLOntology arg0, Class<?> arg1, Type arg2,
+ Annotation[] arg3, MediaType arg4) {
+ // TODO Auto-generated method stub
+ return -1;
+ }
+
+ @Override
+ public boolean isWriteable(Class<?> type, Type genericType,
+ Annotation[] annotations, MediaType mediaType) {
+ return OWLOntology.class.isAssignableFrom(type);
+ }
+
+ @Override
+ public void writeTo(OWLOntology ontology, Class<?> arg1, Type arg2,
+ Annotation[] arg3, MediaType mediaType,
+ MultivaluedMap<String, Object> arg5, OutputStream out)
+ throws IOException, WebApplicationException {
+
+ Logger log = LoggerFactory.getLogger(getClass());
+ OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+
+ log.debug("Rendering ontology " + ontology.getOntologyID()
+ + "to KReS format " + mediaType);
+
+ if (mediaType.toString().equals(KRFormat.RDF_XML)) {
+ try {
+ manager.saveOntology(ontology, new RDFXMLOntologyFormat(), out);
+ } catch (OWLOntologyStorageException e) {
+ log.error("Failed to store ontology for rendering.", e);
+ }
+ } else if (mediaType.toString().equals(KRFormat.OWL_XML)) {
+ try {
+ manager.saveOntology(ontology, new OWLXMLOntologyFormat(), out);
+ } catch (OWLOntologyStorageException e) {
+ log.error("Failed to store ontology for rendering.", e);
+ }
+ } else if (mediaType.toString().equals(KRFormat.MANCHESTER_OWL)) {
+ try {
+ manager.saveOntology(ontology,
+ new ManchesterOWLSyntaxOntologyFormat(), out);
+ } catch (OWLOntologyStorageException e) {
+ log.error("Failed to store ontology for rendering.", e);
+ }
+ } else if (mediaType.toString().equals(KRFormat.FUNCTIONAL_OWL)) {
+ try {
+ manager.saveOntology(ontology,
+ new OWLFunctionalSyntaxOntologyFormat(), out);
+ } catch (OWLOntologyStorageException e) {
+ log.error("Failed to store ontology for rendering.", e);
+ }
+ } else if (mediaType.toString().equals(KRFormat.TURTLE)) {
+ try {
+ manager.saveOntology(ontology, new TurtleOntologyFormat(), out);
+ } catch (OWLOntologyStorageException e) {
+ log.error("Failed to store ontology for rendering.", e);
+ }
+ } else if (mediaType.toString().equals(KRFormat.RDF_JSON)) {
+
+ MGraph mGraph = OWLAPIToClerezzaConverter
+ .owlOntologyToClerezzaMGraph(ontology);
+
+ RdfJsonSerializingProvider provider = new RdfJsonSerializingProvider();
+ provider.serialize(out, mGraph, SupportedFormat.RDF_JSON);
+
+ }
+
+ out.flush();
+ }
+
+}
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owlapi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/java/org/apache/stanbol/owlapi/trasformation/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/resources/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Propchange: incubator/stanbol/trunk/owl/src/main/resources/TestFile/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr 1 12:00:14 2011
@@ -0,0 +1 @@
+target
Added: incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParent.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParent.owl?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParent.owl (added)
+++ incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParent.owl Fri Apr 1 12:00:14 2011
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE Ontology [
+ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+ <!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
+ <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+]>
+
+
+<Ontology xmlns="http://www.w3.org/2002/07/owl#"
+ xml:base="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ ontologyIRI="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl">
+ <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
+ <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
+ <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
+ <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
+ <DLSafeRule>
+ <Annotation>
+ <AnnotationProperty IRI="http://www.semanticweb.org/owlapi#iri"/>
+ <Literal><http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Uncle-Rule></Literal>
+ </Annotation>
+ <Body>
+ <ObjectPropertyAtom>
+ <ObjectProperty IRI="#hasBrother"/>
+ <Variable IRI="#y"/>
+ <Variable IRI="#z"/>
+ </ObjectPropertyAtom>
+ <ObjectPropertyAtom>
+ <ObjectProperty IRI="#hasParent"/>
+ <Variable IRI="#x"/>
+ <Variable IRI="#y"/>
+ </ObjectPropertyAtom>
+ </Body>
+ <Head>
+ <ObjectPropertyAtom>
+ <ObjectProperty IRI="#hasUncle"/>
+ <Variable IRI="#x"/>
+ <Variable IRI="#z"/>
+ </ObjectPropertyAtom>
+ </Head>
+ </DLSafeRule>
+</Ontology>
+
+
+
+<!-- Generated by the OWL API (version 3.0.0.1451) http://owlapi.sourceforge.net -->
+
Added: incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParentRDFXML.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParentRDFXML.owl?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParentRDFXML.owl (added)
+++ incubator/stanbol/trunk/owl/src/main/resources/TestFile/OnlyRuledProvaParentRDFXML.owl Fri Apr 1 12:00:14 2011
@@ -0,0 +1,54 @@
+<rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:j.1="http://www.w3.org/2003/11/swrl#">
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#y">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A0">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
+ <j.1:propertyPredicate rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasParent"/>
+ <j.1:argument2 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#y"/>
+ <j.1:argument1 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#x"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#z">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Uncle-Rule">
+ <j.1:body rdf:nodeID="A1"/>
+ <j.1:head rdf:nodeID="A2"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A1">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
+ <rdf:rest rdf:nodeID="A3"/>
+ <rdf:first rdf:nodeID="A0"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A3">
+ <rdf:first rdf:nodeID="A4"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
+ <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A4">
+ <j.1:propertyPredicate rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasBrother"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
+ <j.1:argument2 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#z"/>
+ <j.1:argument1 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#y"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A2">
+ <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
+ <rdf:first rdf:nodeID="A5"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#x">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A5">
+ <j.1:argument1 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#x"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
+ <j.1:argument2 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#z"/>
+ <j.1:propertyPredicate rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasUncle"/>
+ </rdf:Description>
+</rdf:RDF>
Added: incubator/stanbol/trunk/owl/src/main/resources/TestFile/ProvaParent.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/resources/TestFile/ProvaParent.owl?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/resources/TestFile/ProvaParent.owl (added)
+++ incubator/stanbol/trunk/owl/src/main/resources/TestFile/ProvaParent.owl Fri Apr 1 12:00:14 2011
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE Ontology [
+ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+ <!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
+ <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+]>
+
+
+<Ontology xmlns="http://www.w3.org/2002/07/owl#"
+ xml:base="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ ontologyIRI="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl">
+ <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
+ <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
+ <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
+ <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
+ <Declaration>
+ <Class IRI="#Adult"/>
+ </Declaration>
+ <Declaration>
+ <Class IRI="#Person"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#hasBrother"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#hasParent"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#hasUncle"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#isParentOf"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </Declaration>
+ <Declaration>
+ <DataProperty IRI="#hasAge"/>
+ </Declaration>
+ <Declaration>
+ <DataProperty abbreviatedIRI="owl:topDataProperty"/>
+ </Declaration>
+ <Declaration>
+ <NamedIndividual IRI="#Fred"/>
+ </Declaration>
+ <Declaration>
+ <NamedIndividual IRI="#John"/>
+ </Declaration>
+ <Declaration>
+ <NamedIndividual IRI="#Tom"/>
+ </Declaration>
+ <SubClassOf>
+ <Class IRI="#Adult"/>
+ <Class IRI="#Person"/>
+ </SubClassOf>
+ <ClassAssertion>
+ <Class IRI="#Adult"/>
+ <NamedIndividual IRI="#Fred"/>
+ </ClassAssertion>
+ <ClassAssertion>
+ <Class IRI="#Adult"/>
+ <NamedIndividual IRI="#John"/>
+ </ClassAssertion>
+ <ClassAssertion>
+ <Class IRI="#Person"/>
+ <NamedIndividual IRI="#Tom"/>
+ </ClassAssertion>
+ <ObjectPropertyAssertion>
+ <ObjectProperty IRI="#hasBrother"/>
+ <NamedIndividual IRI="#Fred"/>
+ <NamedIndividual IRI="#John"/>
+ </ObjectPropertyAssertion>
+ <ObjectPropertyAssertion>
+ <ObjectProperty IRI="#hasParent"/>
+ <NamedIndividual IRI="#Tom"/>
+ <NamedIndividual IRI="#Fred"/>
+ </ObjectPropertyAssertion>
+ <DataPropertyAssertion>
+ <DataProperty IRI="#hasAge"/>
+ <NamedIndividual IRI="#Tom"/>
+ <Literal datatypeIRI="&xsd;int">19</Literal>
+ </DataPropertyAssertion>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#hasBrother"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#hasParent"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#hasUncle"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#isParentOf"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <InverseObjectProperties>
+ <ObjectProperty IRI="#isParentOf"/>
+ <ObjectProperty IRI="#hasParent"/>
+ </InverseObjectProperties>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#hasBrother"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#hasParent"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#hasUncle"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#isParentOf"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#hasBrother"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#hasParent"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#hasUncle"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#isParentOf"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <SubDataPropertyOf>
+ <DataProperty IRI="#hasAge"/>
+ <DataProperty abbreviatedIRI="owl:topDataProperty"/>
+ </SubDataPropertyOf>
+ <DataPropertyDomain>
+ <DataProperty IRI="#hasAge"/>
+ <Class IRI="#Person"/>
+ </DataPropertyDomain>
+ <DataPropertyRange>
+ <DataProperty IRI="#hasAge"/>
+ <Datatype abbreviatedIRI="xsd:int"/>
+ </DataPropertyRange>
+</Ontology>
+
+
+
+<!-- Generated by the OWL API (version 3.0.0.1451) http://owlapi.sourceforge.net -->
+
Added: incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParent.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParent.owl?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParent.owl (added)
+++ incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParent.owl Fri Apr 1 12:00:14 2011
@@ -0,0 +1,187 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE Ontology [
+ <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+ <!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
+ <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+]>
+
+
+<Ontology xmlns="http://www.w3.org/2002/07/owl#"
+ xml:base="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
+ ontologyIRI="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl">
+ <Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
+ <Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
+ <Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
+ <Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
+ <Declaration>
+ <Class IRI="#Adult"/>
+ </Declaration>
+ <Declaration>
+ <Class IRI="#Person"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#hasBrother"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#hasParent"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#hasUncle"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty IRI="#isParentOf"/>
+ </Declaration>
+ <Declaration>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </Declaration>
+ <Declaration>
+ <DataProperty IRI="#hasAge"/>
+ </Declaration>
+ <Declaration>
+ <DataProperty abbreviatedIRI="owl:topDataProperty"/>
+ </Declaration>
+ <Declaration>
+ <NamedIndividual IRI="#Fred"/>
+ </Declaration>
+ <Declaration>
+ <NamedIndividual IRI="#John"/>
+ </Declaration>
+ <Declaration>
+ <NamedIndividual IRI="#Tom"/>
+ </Declaration>
+ <Declaration>
+ <AnnotationProperty IRI="http://www.semanticweb.org/owlapi#iri"/>
+ </Declaration>
+ <SubClassOf>
+ <Class IRI="#Adult"/>
+ <Class IRI="#Person"/>
+ </SubClassOf>
+ <ClassAssertion>
+ <Class IRI="#Adult"/>
+ <NamedIndividual IRI="#Fred"/>
+ </ClassAssertion>
+ <ClassAssertion>
+ <Class IRI="#Adult"/>
+ <NamedIndividual IRI="#John"/>
+ </ClassAssertion>
+ <ClassAssertion>
+ <Class IRI="#Person"/>
+ <NamedIndividual IRI="#Tom"/>
+ </ClassAssertion>
+ <ObjectPropertyAssertion>
+ <ObjectProperty IRI="#hasBrother"/>
+ <NamedIndividual IRI="#Fred"/>
+ <NamedIndividual IRI="#John"/>
+ </ObjectPropertyAssertion>
+ <ObjectPropertyAssertion>
+ <ObjectProperty IRI="#hasParent"/>
+ <NamedIndividual IRI="#Tom"/>
+ <NamedIndividual IRI="#Fred"/>
+ </ObjectPropertyAssertion>
+ <DataPropertyAssertion>
+ <DataProperty IRI="#hasAge"/>
+ <NamedIndividual IRI="#Tom"/>
+ <Literal datatypeIRI="&xsd;int">19</Literal>
+ </DataPropertyAssertion>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#hasBrother"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#hasParent"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#hasUncle"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <SubObjectPropertyOf>
+ <ObjectProperty IRI="#isParentOf"/>
+ <ObjectProperty abbreviatedIRI="owl:topObjectProperty"/>
+ </SubObjectPropertyOf>
+ <InverseObjectProperties>
+ <ObjectProperty IRI="#isParentOf"/>
+ <ObjectProperty IRI="#hasParent"/>
+ </InverseObjectProperties>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#hasBrother"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#hasParent"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#hasUncle"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyDomain>
+ <ObjectProperty IRI="#isParentOf"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyDomain>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#hasBrother"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#hasParent"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#hasUncle"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <ObjectPropertyRange>
+ <ObjectProperty IRI="#isParentOf"/>
+ <Class IRI="#Person"/>
+ </ObjectPropertyRange>
+ <SubDataPropertyOf>
+ <DataProperty IRI="#hasAge"/>
+ <DataProperty abbreviatedIRI="owl:topDataProperty"/>
+ </SubDataPropertyOf>
+ <DataPropertyDomain>
+ <DataProperty IRI="#hasAge"/>
+ <Class IRI="#Person"/>
+ </DataPropertyDomain>
+ <DataPropertyRange>
+ <DataProperty IRI="#hasAge"/>
+ <Datatype abbreviatedIRI="xsd:int"/>
+ </DataPropertyRange>
+ <DLSafeRule>
+ <Annotation>
+ <AnnotationProperty IRI="http://www.semanticweb.org/owlapi#nodeID"/>
+ <Literal>_:http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#genid1</Literal>
+ </Annotation>
+ <Body>
+ <ObjectPropertyAtom>
+ <ObjectProperty IRI="#hasBrother"/>
+ <Variable IRI="#y"/>
+ <Variable IRI="#z"/>
+ </ObjectPropertyAtom>
+ <ObjectPropertyAtom>
+ <ObjectProperty IRI="#hasParent"/>
+ <Variable IRI="#x"/>
+ <Variable IRI="#y"/>
+ </ObjectPropertyAtom>
+ </Body>
+ <Head>
+ <ObjectPropertyAtom>
+ <ObjectProperty IRI="#hasUncle"/>
+ <Variable IRI="#x"/>
+ <Variable IRI="#z"/>
+ </ObjectPropertyAtom>
+ </Head>
+ </DLSafeRule>
+</Ontology>
+
+
+
+<!-- Generated by the OWL API (version 3.0.0.1451) http://owlapi.sourceforge.net -->
+
Added: incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParentRDFXML.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParentRDFXML.owl?rev=1087665&view=auto
==============================================================================
--- incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParentRDFXML.owl (added)
+++ incubator/stanbol/trunk/owl/src/main/resources/TestFile/RuledProvaParentRDFXML.owl Fri Apr 1 12:00:14 2011
@@ -0,0 +1,110 @@
+<rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:j.0="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#"
+ xmlns:owl="http://www.w3.org/2002/07/owl#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:j.1="http://www.w3.org/2003/11/swrl#"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#y">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Fred">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
+ <rdf:type rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Adult"/>
+ <j.0:hasBrother rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#John"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A0">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
+ <j.1:propertyPredicate rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasParent"/>
+ <j.1:argument2 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#y"/>
+ <j.1:argument1 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#x"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#z">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Uncle-Rule">
+ <j.1:body rdf:nodeID="A1"/>
+ <j.1:head rdf:nodeID="A2"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A1">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
+ <rdf:rest rdf:nodeID="A3"/>
+ <rdf:first rdf:nodeID="A0"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasAge">
+ <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/>
+ <rdfs:domain rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topDataProperty"/>
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#John">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
+ <rdf:type rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Adult"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A3">
+ <rdf:first rdf:nodeID="A4"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
+ <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A4">
+ <j.1:propertyPredicate rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasBrother"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
+ <j.1:argument2 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#z"/>
+ <j.1:argument1 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#y"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Adult">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
+ <rdfs:subClassOf rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.w3.org/2002/07/owl#topDataProperty">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.w3.org/2002/07/owl#topObjectProperty">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A2">
+ <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
+ <rdf:first rdf:nodeID="A5"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#x">
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasBrother">
+ <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topObjectProperty"/>
+ <rdfs:domain rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+ <rdfs:range rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasUncle">
+ <rdfs:range rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topObjectProperty"/>
+ <rdfs:domain rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+ </rdf:Description>
+ <rdf:Description rdf:nodeID="A5">
+ <j.1:argument1 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#x"/>
+ <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
+ <j.1:argument2 rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#z"/>
+ <j.1:propertyPredicate rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasUncle"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Tom">
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
+ <rdf:type rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ <j.0:hasAge rdf:datatype="http://www.w3.org/2001/XMLSchema#int">19</j.0:hasAge>
+ <j.0:hasParent rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Fred"/>
+ </rdf:Description>
+ <rdf:Description rdf:about="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#hasParent">
+ <rdfs:range rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ <rdfs:domain rdf:resource="http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#Person"/>
+ <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#ObjectProperty"/>
+ <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topObjectProperty"/>
+ </rdf:Description>
+</rdf:RDF>