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:47:56 UTC

svn commit: r1087688 [9/19] - in /incubator/stanbol/trunk/rules: ./ base/ base/.settings/ base/src/ base/src/main/ base/src/main/java/ base/src/main/java/org/ base/src/main/java/org/apache/ base/src/main/java/org/apache/stanbol/ base/src/main/java/org/...

Added: incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java (added)
+++ incubator/stanbol/trunk/rules/manager/src/test/java/org/apache/stanbol/rules/manager/parse/RuleParserTest.java Fri Apr  1 12:47:48 2011
@@ -0,0 +1,48 @@
+package org.apache.stanbol.rules.manager.parse;
+
+import org.apache.stanbol.rules.base.api.Rule;
+import org.apache.stanbol.rules.base.api.util.RuleList;
+import org.apache.stanbol.rules.manager.KB;
+import org.apache.stanbol.rules.manager.parse.RuleParserImpl;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+
+/**
+ * 
+ * @author andrea.nuzzolese
+ *
+ */
+public class RuleParserTest {
+
+	private static String kReSRule;
+	
+	@BeforeClass
+	public static void setup() {
+		kReSRule = "ProvaParent = <http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#> . " +
+		"rule1[ has(ProvaParent:hasParent, ?x, ?y) . has(ProvaParent:hasBrother, ?y, ?z) -> " +
+		"has(ProvaParent:hasUncle, ?x, ?z) ]";
+	}
+	
+	@Test
+	public void testParser(){
+		try{
+			KB kReSKB = RuleParserImpl.parse(kReSRule);
+			if(kReSKB != null){
+				RuleList kReSRuleList = kReSKB.getkReSRuleList();
+				if(kReSRuleList != null){
+					for(Rule kReSRule : kReSRuleList){
+						System.out.println("RULE : "+kReSRule.toString());
+					}
+				}
+				System.out.println("RULE LIST IS NULL");
+			}
+			else{
+				System.out.println("KB IS NULL");
+			}
+		}catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+}

Added: incubator/stanbol/trunk/rules/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/pom.xml?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/pom.xml (added)
+++ incubator/stanbol/trunk/rules/pom.xml Fri Apr  1 12:47:48 2011
@@ -0,0 +1,49 @@
+<?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>
+
+  <groupId>org.apache.stanbol</groupId>
+  <artifactId>org.apache.stanbol.rules.reactor</artifactId>
+  <packaging>pom</packaging>
+  <version>${stanbol-version}</version>
+
+  <name>Apache Stanbol Rules reactor</name>
+  <description>
+    Pseudo project to build the complete Apache Stanbol Rules.
+  </description>
+
+  <inceptionYear>2011</inceptionYear>
+
+  <modules>
+    <module>base</module>      
+    <module>manager</module>
+    <module>refactor</module>    
+    <module>web</module>
+  </modules>
+  
+</project>

Propchange: incubator/stanbol/trunk/rules/refactor/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/trunk/rules/refactor/.classpath
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/.classpath?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/.classpath (added)
+++ incubator/stanbol/trunk/rules/refactor/.classpath Fri Apr  1 12:47:48 2011
@@ -0,0 +1,60 @@
+<classpath>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
+  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar" sourcepath="M2_REPO/javax/activation/activation/1.1/activation-1.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/hp/hpl/jena/arq/2.8.3/arq-2.8.3.jar" sourcepath="M2_REPO/com/hp/hpl/jena/arq/2.8.3/arq-2.8.3-sources.jar">
+    <attributes>
+      <attribute value="jar:file:/home/x-marley/.m2/repository/com/hp/hpl/jena/arq/2.8.3/arq-2.8.3-javadoc.jar!/" name="javadoc_location"/>
+    </attributes>
+  </classpathentry>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/hermit/hermit/1.2.4/hermit-1.2.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.0/httpcore-4.0.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.0/httpcore-4.0-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/ibm/icu/icu4j/3.4.4/icu4j-3.4.4.jar" sourcepath="M2_REPO/com/ibm/icu/icu4j/3.4.4/icu4j-3.4.4-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/com/hp/hpl/jena/iri/0.8/iri-0.8.jar" sourcepath="M2_REPO/com/hp/hpl/jena/iri/0.8/iri-0.8-sources.jar">
+    <attributes>
+      <attribute value="jar:file:/home/x-marley/.m2/repository/com/hp/hpl/jena/iri/0.8/iri-0.8-javadoc.jar!/" name="javadoc_location"/>
+    </attributes>
+  </classpathentry>
+  <classpathentry kind="var" path="M2_REPO/com/hp/hpl/jena/jena/2.6.2/jena-2.6.2.jar" sourcepath="M2_REPO/com/hp/hpl/jena/jena/2.6.2/jena-2.6.2-sources.jar">
+    <attributes>
+      <attribute value="jar:file:/home/x-marley/.m2/repository/com/hp/hpl/jena/jena/2.6.2/jena-2.6.2-javadoc.jar!/" name="javadoc_location"/>
+    </attributes>
+  </classpathentry>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar">
+    <attributes>
+      <attribute value="jar:file:/home/x-marley/.m2/repository/junit/junit/4.4/junit-4.4-javadoc.jar!/" name="javadoc_location"/>
+    </attributes>
+  </classpathentry>
+  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar" sourcepath="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-core/2.9.4/lucene-core-2.9.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.core/0.12-incubating-SNAPSHOT/org.apache.clerezza.rdf.core-0.12-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.core/0.12-incubating-SNAPSHOT/org.apache.clerezza.rdf.core-0.12-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.commons/0.5-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.commons-0.5-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.commons/0.5-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.commons-0.5-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.facade/0.12-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.facade-0.12-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.facade/0.12-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.facade-0.12-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.parser/0.10-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.parser-0.10-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.parser/0.10-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.parser-0.10-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.serializer/0.9-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.serializer-0.9-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.serializer/0.9-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.serializer-0.9-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.sparql/0.5-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.sparql-0.5-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.sparql/0.5-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.sparql-0.5-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.storage/0.5-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.storage-0.5-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.jena.storage/0.5-incubating-SNAPSHOT/org.apache.clerezza.rdf.jena.storage-0.5-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.simple.storage/0.7-incubating-SNAPSHOT/org.apache.clerezza.rdf.simple.storage-0.7-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.rdf.simple.storage/0.7-incubating-SNAPSHOT/org.apache.clerezza.rdf.simple.storage-0.7-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/clerezza/org.apache.clerezza.utils/0.1-incubating-SNAPSHOT/org.apache.clerezza.utils-0.1-incubating-SNAPSHOT.jar" sourcepath="M2_REPO/org/apache/clerezza/org.apache.clerezza.utils/0.1-incubating-SNAPSHOT/org.apache.clerezza.utils-0.1-incubating-SNAPSHOT-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/felix/org.apache.felix.scr.annotations/1.2.0/org.apache.felix.scr.annotations-1.2.0.jar" sourcepath="M2_REPO/org/apache/felix/org.apache.felix.scr.annotations/1.2.0/org.apache.felix.scr.annotations-1.2.0-sources.jar"/>
+  <classpathentry kind="src" path="/org.apache.stanbol.ontologymanager.ontonet"/>
+  <classpathentry kind="src" path="/org.apache.stanbol.owlapi"/>
+  <classpathentry kind="src" path="/org.apache.stanbol.reasoners.base"/>
+  <classpathentry kind="src" path="/org.apache.stanbol.rules.base"/>
+  <classpathentry kind="src" path="/org.apache.stanbol.rules.manager"/>
+  <classpathentry kind="var" path="M2_REPO/org/osgi/org.osgi.compendium/4.1.0/org.osgi.compendium-4.1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/felix/org.osgi.core/1.4.0/org.osgi.core-1.4.0.jar" sourcepath="M2_REPO/org/apache/felix/org.osgi.core/1.4.0/org.osgi.core-1.4.0-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/osgi/org.osgi.core/4.1.0/org.osgi.core-4.1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/owl-link/owl-link/1.0.2/owl-link-1.0.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/owlapi/owlapi/3.0.0/owlapi-3.0.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.2/slf4j-api-1.5.2.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.5.2/slf4j-api-1.5.2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-simple/1.5.2/slf4j-simple-1.5.2.jar" sourcepath="M2_REPO/org/slf4j/slf4j-simple/1.5.2/slf4j-simple-1.5.2-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/wymiwyg/wymiwyg-commons-core/0.7.5/wymiwyg-commons-core-0.7.5.jar" sourcepath="M2_REPO/org/wymiwyg/wymiwyg-commons-core/0.7.5/wymiwyg-commons-core-0.7.5-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.7.1/xercesImpl-2.7.1.jar"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file

Added: incubator/stanbol/trunk/rules/refactor/.project
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/.project?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/.project (added)
+++ incubator/stanbol/trunk/rules/refactor/.project Fri Apr  1 12:47:48 2011
@@ -0,0 +1,28 @@
+<projectDescription>
+  <name>org.apache.stanbol.rules.refactor</name>
+  <comment>Provides basic functionality for ontology refactoring. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+  <projects>
+    <project>org.apache.stanbol.ontologymanager.ontonet</project>
+    <project>org.apache.stanbol.owlapi</project>
+    <project>org.apache.stanbol.reasoners.base</project>
+    <project>org.apache.stanbol.rules.base</project>
+    <project>org.apache.stanbol.rules.manager</project>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.maven.ide.eclipse.maven2Builder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.m2e.core.maven2Builder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.pde.PluginNature</nature>
+    <nature>org.eclipse.m2e.core.maven2Nature</nature>
+    <nature>org.maven.ide.eclipse.maven2Nature</nature>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Propchange: incubator/stanbol/trunk/rules/refactor/.settings/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.jdt.core.prefs?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.jdt.core.prefs (added)
+++ incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.jdt.core.prefs Fri Apr  1 12:47:48 2011
@@ -0,0 +1,6 @@
+#Fri Mar 18 11:28:58 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6

Added: incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.m2e.core.prefs
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.m2e.core.prefs?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.m2e.core.prefs (added)
+++ incubator/stanbol/trunk/rules/refactor/.settings/org.eclipse.m2e.core.prefs Fri Apr  1 12:47:48 2011
@@ -0,0 +1,5 @@
+#Wed Mar 23 17:37:40 GMT 2011
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

Added: incubator/stanbol/trunk/rules/refactor/.settings/org.maven.ide.eclipse.prefs
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/.settings/org.maven.ide.eclipse.prefs?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/.settings/org.maven.ide.eclipse.prefs (added)
+++ incubator/stanbol/trunk/rules/refactor/.settings/org.maven.ide.eclipse.prefs Fri Apr  1 12:47:48 2011
@@ -0,0 +1,9 @@
+#Thu Mar 17 16:08:39 CET 2011
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Added: incubator/stanbol/trunk/rules/refactor/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/pom.xml?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/pom.xml (added)
+++ incubator/stanbol/trunk/rules/refactor/pom.xml Fri Apr  1 12:47:48 2011
@@ -0,0 +1,201 @@
+<?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>
+
+	<groupId>org.apache.stanbol</groupId>
+	<artifactId>org.apache.stanbol.rules.refactor</artifactId>
+	<packaging>bundle</packaging>
+	<version>${stanbol-version}</version>
+
+	<name>Apache Stanbol Refactorer</name>
+	<description>
+		Provides basic functionality for ontology refactoring.
+	</description>
+
+	<inceptionYear>2010</inceptionYear>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Export-Package>
+							org.apache.stanbol.rules.refactor.*;version=${stanbol-version}
+	          			</Export-Package>
+						<Import-Package>
+							org.slf4j.*;version=1.5.2,
+							*
+            			</Import-Package>
+						<_nouses>true</_nouses>
+					</instructions>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-scr-plugin</artifactId>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.6</source>
+					<target>1.6</target>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+	<dependencies>
+
+		<!-- OSGi deps -->
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.core</artifactId>
+			<version>4.1.0</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.compendium</artifactId>
+			<version>4.1.0</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.scr.annotations</artifactId>
+			<version>1.2.0</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<!-- OWL deps -->
+		<dependency>
+			<groupId>com.hp.hpl.jena</groupId>
+			<artifactId>arq</artifactId>
+			<version>2.8.3</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.hp.hpl.jena</groupId>
+			<artifactId>jena</artifactId>
+			<version>2.6.2</version>
+		</dependency>
+		<dependency>
+			<groupId>owlapi</groupId>
+			<artifactId>owlapi</artifactId>
+			<version>3.0.0</version>
+		</dependency>
+
+		<!-- Persistence deps -->
+		<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.sparql</artifactId>
+			<version>0.5-incubating-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>org.apache.clerezza.rdf.simple.storage</artifactId>
+			<version>0.7-incubating-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<!-- Stanbol deps -->
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.owl</artifactId>
+			<version>${stanbol-version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.ontologymanager.ontonet</artifactId>
+			<version>${stanbol-version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.rules.base</artifactId>
+			<version>${stanbol-version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.rules.manager</artifactId>
+			<version>${stanbol-version}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<!-- Diagnostics deps -->
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.5.2</version>
+			<type>jar</type>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-simple</artifactId>
+			<version>1.5.2</version>
+			<type>jar</type>
+			<scope>provided</scope>
+		</dependency>
+
+		<!-- Testing deps -->
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.4</version>
+			<scope>test</scope>
+		</dependency>
+
+	</dependencies>
+
+
+	<repositories>
+		<repository>
+			<id>stlab-cnr-repo</id>
+			<url>http://stlab.istc.cnr.it/software/maven/repo</url>
+		</repository>
+	</repositories>
+
+</project>

Propchange: incubator/stanbol/trunk/rules/refactor/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java (added)
+++ incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/Refactorer.java Fri Apr  1 12:47:48 2011
@@ -0,0 +1,59 @@
+package org.apache.stanbol.rules.refactor.api;
+
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.stanbol.rules.base.api.NoSuchRecipeException;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+/**
+ * A SemionReengineer provides methods for performing ontology refactorings. Refactoring are performed using
+ * recipes that contain sets of rules that describe the refactoring to do. Rules are expressed using the both
+ * the SWRL model and the KReS rules language.
+ * 
+ * @author andrea.nuzzolese
+ * 
+ */
+public interface Refactorer {
+
+    /**
+     * Fetch the mgraph with the selected uri from the storage.
+     * 
+     * @param uriRef
+     *            {@link UriRef}
+     * @return the {@link MGraph}.
+     */
+    public MGraph getRefactoredDataSet(UriRef uriRef);
+
+    /**
+     * The refactoring is perfomed by the {@code Refactorer} by invoking this method. The {@code datasetURI}
+     * is the {@link IRI} of an IKS ontology and the {@code recipe} is the recipe that needs to be applied to
+     * ontology in order to perform the refactoring.
+     * 
+     * @param refactoredDataSetURI
+     *            {@link IRI}
+     * @param datasetURI
+     *            {@link IRI}
+     * @param recipeIRI
+     *            {@link IRI}
+     */
+    public void ontologyRefactoring(IRI refactoredDataSetURI, IRI datasetURI, IRI recipeIRI) throws RefactoringException,
+                                                                                            NoSuchRecipeException;
+
+    /**
+     * The refactoring is perfomed by the {@code Refactorer} by invoking this method. The {@code datasetURI}
+     * is the URI of an RDF graph in KReS and the {@code recipe} is the recipe that needs to be applied to RDF
+     * graph in order to obtain the refactoring.
+     * 
+     * @param datasetURI
+     *            {@link UriRef}
+     * @param recipe
+     *            {@link UriRef}
+     * @return the refactored {@link MGraph}
+     * @throws RefactoringException
+     * @throws NoSuchRecipeException
+     */
+    public OWLOntology ontologyRefactoring(OWLOntology datasetURI, IRI recipeIRI) throws RefactoringException,
+                                                                                 NoSuchRecipeException;
+
+}

Added: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/RefactoringException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/RefactoringException.java?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/RefactoringException.java (added)
+++ incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/RefactoringException.java Fri Apr  1 12:47:48 2011
@@ -0,0 +1,33 @@
+package org.apache.stanbol.rules.refactor.api;
+
+import org.semanticweb.owlapi.model.IRI;
+
+
+/**
+ * 
+ * @author andrea.nuzzolese
+ *
+ */
+
+public class RefactoringException extends Exception {
+	
+	
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	
+	protected IRI recipeIRI;
+
+	/**
+	 * Creates a new instance of RefactoringException.
+	 */
+	public RefactoringException() {
+		
+	}
+	
+		
+	
+
+}

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/util/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/util/URIGenerator.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/util/URIGenerator.java?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/util/URIGenerator.java (added)
+++ incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/api/util/URIGenerator.java Fri Apr  1 12:47:48 2011
@@ -0,0 +1,87 @@
+package org.apache.stanbol.rules.refactor.api.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+public class URIGenerator {
+
+	
+	public static final String SHA1 = "SHA1";
+
+    public static final int MIN_BUF_SIZE = 8 * 1024; // 8 kB
+
+    public static final int MAX_BUF_SIZE = 64 * 1024; // 64 kB
+    
+    private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
+	
+	
+	public static String createID(String baseUri, byte[] content) {
+	
+		
+        // calculate an ID based on the digest of the content
+        String hexDigest = "";
+        if (!baseUri.startsWith("urn:") && !baseUri.endsWith("/")) {
+            baseUri = baseUri + "/";
+        }
+        try {
+            hexDigest = streamDigest(
+                    new ByteArrayInputStream(content), null, SHA1);
+        } catch (IOException e) {
+            // this is not going to happen since output stream is null and the
+            // input data is already loaded in memory
+        }
+        
+        return baseUri + SHA1.toLowerCase() + "-" + hexDigest;
+    }
+    
+    
+    
+    
+    public static String streamDigest(InputStream in, OutputStream out,
+            String digestAlgorithm) throws IOException {
+        MessageDigest digest;
+        try {
+            digest = MessageDigest.getInstance(digestAlgorithm);
+        } catch (NoSuchAlgorithmException e) {
+            throw (IOException) new IOException().initCause(e);
+        }
+
+        int size = in.available();
+        if (size == 0) {
+            size = MAX_BUF_SIZE;
+        } else if (size < MIN_BUF_SIZE) {
+            size = MIN_BUF_SIZE;
+        } else if (size > MAX_BUF_SIZE) {
+            size = MAX_BUF_SIZE;
+        }
+        byte[] buf = new byte[size];
+
+        /*
+         * Copy and digest.
+         */
+        int n;
+        while ((n = in.read(buf)) != -1) {
+            if (out != null) {
+                out.write(buf, 0, n);
+            }
+            digest.update(buf, 0, n);
+        }
+        if (out != null) {
+            out.flush();
+        }
+        return toHexString(digest.digest());
+    }
+    
+    public static String toHexString(byte[] data) {
+        StringBuilder buf = new StringBuilder(2 * data.length);
+        for (byte b : data) {
+            buf.append(HEX_DIGITS[(0xF0 & b) >> 4]);
+            buf.append(HEX_DIGITS[0x0F & b]);
+        }
+        return buf.toString();
+    }
+}

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/impl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/impl/RefactorerImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/impl/RefactorerImpl.java?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/impl/RefactorerImpl.java (added)
+++ incubator/stanbol/trunk/rules/refactor/src/main/java/org/apache/stanbol/rules/refactor/impl/RefactorerImpl.java Fri Apr  1 12:47:48 2011
@@ -0,0 +1,476 @@
+package org.apache.stanbol.rules.refactor.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Dictionary;
+
+import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
+import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.ontologymanager.ontonet.api.DuplicateIDException;
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyScope;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyScopeFactory;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpaceFactory;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.ScopeRegistry;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.DuplicateSessionIDException;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.Session;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.SessionManager;
+import org.apache.stanbol.ontologymanager.ontonet.impl.io.ClerezzaOntologyStorage;
+import org.apache.stanbol.owl.trasformation.JenaToClerezzaConverter;
+import org.apache.stanbol.owl.trasformation.OWLAPIToClerezzaConverter;
+import org.apache.stanbol.rules.base.api.NoSuchRecipeException;
+import org.apache.stanbol.rules.base.api.Recipe;
+import org.apache.stanbol.rules.base.api.Rule;
+import org.apache.stanbol.rules.base.api.RuleStore;
+import org.apache.stanbol.rules.base.api.util.RuleList;
+import org.apache.stanbol.rules.manager.arqextention.CreatePropertyURIStringFromLabel;
+import org.apache.stanbol.rules.manager.arqextention.CreateStandardLabel;
+import org.apache.stanbol.rules.manager.arqextention.CreateURI;
+import org.apache.stanbol.rules.refactor.api.Refactorer;
+import org.apache.stanbol.rules.refactor.api.RefactoringException;
+import org.apache.stanbol.rules.refactor.api.util.URIGenerator;
+import org.osgi.service.component.ComponentContext;
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.io.RDFXMLOntologyFormat;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+import org.semanticweb.owlapi.model.OWLOntologyStorageException;
+import org.semanticweb.owlapi.util.OWLOntologyMerger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.query.Query;
+import com.hp.hpl.jena.query.QueryExecution;
+import com.hp.hpl.jena.query.QueryExecutionFactory;
+import com.hp.hpl.jena.query.QueryFactory;
+import com.hp.hpl.jena.query.Syntax;
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.reasoner.Reasoner;
+import com.hp.hpl.jena.sparql.function.FunctionRegistry;
+import com.hp.hpl.jena.sparql.pfunction.PropertyFunctionRegistry;
+import com.hp.hpl.jena.update.UpdateAction;
+
+/**
+ * The RefactorerImpl is the concrete implementation of the Refactorer interface defined in the KReS APIs. A
+ * SemionRefacter is able to perform ontology refactorings and mappings.
+ * 
+ * @author andrea.nuzzolese
+ * 
+ */
+
+@Component(immediate = true, metatype = true)
+@Service(Refactorer.class)
+public class RefactorerImpl implements Refactorer {
+
+    public static final String _AUTO_GENERATED_ONTOLOGY_IRI_DEFAULT = "http://kres.iksproject.eu/semion/autoGeneratedOntology";
+    public static final String _HOST_NAME_AND_PORT_DEFAULT = "localhost:8080";
+    public static final String _REFACTORING_SCOPE_DEFAULT = "refactoring";
+    public static final String _REFACTORING_SESSION_ID_DEFAULT = "http://kres.iksproject.eu/session/refactoring";
+    public static final String _REFACTORING_SPACE_DEFAULT = "http://kres.iksproject.eu/space/refactoring";
+
+    @Property(value = _AUTO_GENERATED_ONTOLOGY_IRI_DEFAULT)
+    public static final String AUTO_GENERATED_ONTOLOGY_IRI = "org.apache.stanbol.reengineer.default";
+
+    @Property(value = _HOST_NAME_AND_PORT_DEFAULT)
+    public static final String HOST_NAME_AND_PORT = "host.name.port";
+
+    @Property(_REFACTORING_SCOPE_DEFAULT)
+    public static final String REFACTORING_SCOPE = "org.apache.stanbol.ontologymanager.scope.refactoring";
+
+    @Property(value = _REFACTORING_SESSION_ID_DEFAULT)
+    public static final String REFACTORING_SESSION_ID = "org.apache.stanbol.ontlogymanager.session.refactoring";
+
+    @Property(value = _REFACTORING_SPACE_DEFAULT)
+    public static final String REFACTORING_SPACE = "org.apache.stanbol.reengineer.space.refactoring";
+
+    private IRI defaultRefactoringIRI;
+
+    private IRI kReSSessionID;
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private IRI refactoringScopeIRI;
+
+    private IRI refactoringSpaceIRI;
+
+    private OntologyScope scope;
+
+    @Reference
+    protected ONManager onManager;
+    @Reference
+    protected RuleStore ruleStore;
+
+    @Reference
+    protected Serializer serializer;
+    @Reference
+    protected TcManager tcManager;
+    @Reference
+    protected WeightedTcProvider weightedTcProvider;
+
+    /**
+     * This default constructor is <b>only</b> intended to be used by the OSGI environment with Service
+     * Component Runtime support.
+     * <p>
+     * DO NOT USE to manually create instances - the RefactorerImpl instances do need to be configured! YOU
+     * NEED TO USE
+     * {@link #RefactorerImpl(WeightedTcProvider, Serializer, TcManager, ONManager, SemionManager, RuleStore, Reasoner, Dictionary)}
+     * or its overloads, to parse the configuration and then initialise the rule store if running outside a
+     * OSGI environment.
+     */
+    public RefactorerImpl() {
+
+    }
+
+    /**
+     * Basic constructor to be used if outside of an OSGi environment. Invokes default constructor.
+     * 
+     * @param weightedTcProvider
+     * @param serializer
+     * @param tcManager
+     * @param onManager
+     * @param semionManager
+     * @param ruleStore
+     * @param kReSReasoner
+     * @param configuration
+     */
+    public RefactorerImpl(WeightedTcProvider weightedTcProvider,
+                          Serializer serializer,
+                          TcManager tcManager,
+                          ONManager onManager, /* SemionManager semionManager, */
+                          RuleStore ruleStore,
+                          Dictionary<String,Object> configuration) {
+        this();
+        this.weightedTcProvider = weightedTcProvider;
+        this.serializer = serializer;
+        this.tcManager = tcManager;
+        this.onManager = onManager;
+        // this.semionManager = semionManager;
+        this.ruleStore = ruleStore;
+        activate(configuration);
+    }
+
+    /**
+     * Used to configure an instance within an OSGi container.
+     * 
+     * @throws IOException
+     */
+    @SuppressWarnings("unchecked")
+    @Activate
+    protected void activate(ComponentContext context) throws IOException {
+        log.info("in " + getClass() + " activate with context " + context);
+        if (context == null) {
+            throw new IllegalStateException("No valid" + ComponentContext.class + " parsed in activate!");
+        }
+        activate((Dictionary<String,Object>) context.getProperties());
+    }
+
+    protected void activate(Dictionary<String,Object> configuration) {
+        String refactoringSessionID = (String) configuration.get(REFACTORING_SESSION_ID);
+        if (refactoringSessionID == null) refactoringSessionID = _REFACTORING_SESSION_ID_DEFAULT;
+        String refactoringScopeID = (String) configuration.get(REFACTORING_SCOPE);
+        if (refactoringScopeID == null) refactoringScopeID = _REFACTORING_SCOPE_DEFAULT;
+        String refactoringSpaceID = (String) configuration.get(REFACTORING_SPACE);
+        if (refactoringSpaceID == null) refactoringSpaceID = _REFACTORING_SPACE_DEFAULT;
+        String defaultRefactoringID = (String) configuration.get(AUTO_GENERATED_ONTOLOGY_IRI);
+        if (defaultRefactoringID == null) defaultRefactoringID = _AUTO_GENERATED_ONTOLOGY_IRI_DEFAULT;
+        String hostPort = (String) configuration.get(HOST_NAME_AND_PORT);
+        if (hostPort == null) hostPort = _HOST_NAME_AND_PORT_DEFAULT;
+
+        kReSSessionID = IRI.create(refactoringSessionID);
+        refactoringScopeIRI = IRI.create("http://" + hostPort + "/kres/ontology/" + refactoringScopeID);
+        refactoringSpaceIRI = IRI.create(refactoringSpaceID);
+        defaultRefactoringIRI = IRI.create(defaultRefactoringID);
+
+        SessionManager kReSSessionManager = onManager.getSessionManager();
+
+        Session kReSSession = kReSSessionManager.getSession(kReSSessionID);
+
+        if (kReSSession == null) {
+            try {
+                kReSSession = kReSSessionManager.createSession(kReSSessionID);
+            } catch (DuplicateSessionIDException e) {
+                log.error("SemionRefactorer : a KReS session for reengineering seems already existing", e);
+            }
+        }
+
+        kReSSessionID = kReSSession.getID();
+
+        OntologyScopeFactory ontologyScopeFactory = onManager.getOntologyScopeFactory();
+
+        ScopeRegistry scopeRegistry = onManager.getScopeRegistry();
+
+        OntologySpaceFactory ontologySpaceFactory = onManager.getOntologySpaceFactory();
+
+        scope = null;
+        try {
+            log.info("Semion DBExtractor : created scope with IRI " + REFACTORING_SCOPE);
+
+            scope = ontologyScopeFactory.createOntologyScope(refactoringScopeIRI, null);
+
+            scopeRegistry.registerScope(scope);
+        } catch (DuplicateIDException e) {
+            log.info("Semion DBExtractor : already existing scope for IRI " + REFACTORING_SCOPE);
+            scope = onManager.getScopeRegistry().getScope(refactoringScopeIRI);
+        }
+
+        scope.addSessionSpace(ontologySpaceFactory.createSessionOntologySpace(refactoringSpaceIRI),
+            kReSSession.getID());
+
+        scopeRegistry.setScopeActive(refactoringScopeIRI, true);
+
+        // semionManager.registerRefactorer(this);
+
+        PropertyFunctionRegistry.get().put("http://www.stlab.istc.cnr.it/semion/function#createURI",
+            CreateURI.class);
+        FunctionRegistry.get().put("http://www.stlab.istc.cnr.it/semion/function#createLabel",
+            CreateStandardLabel.class);
+        FunctionRegistry.get().put("http://www.stlab.istc.cnr.it/semion/function#propString",
+            CreatePropertyURIStringFromLabel.class);
+
+        log.info("Activated KReS Semion Refactorer");
+    }
+
+    @Deactivate
+    protected void deactivate(ComponentContext context) {
+        log.info("in " + getClass() + " deactivate with context " + context);
+
+        SessionManager kReSSessionManager = onManager.getSessionManager();
+        kReSSessionManager.destroySession(kReSSessionID);
+        // semionManager.unregisterRefactorer();
+        this.weightedTcProvider = null;
+        this.serializer = null;
+        this.tcManager = null;
+        this.onManager = null;
+        this.ruleStore = null;
+    }
+
+    @Override
+    public MGraph getRefactoredDataSet(UriRef uriRef) {
+
+        return weightedTcProvider.getMGraph(uriRef);
+    }
+
+    @Override
+    public void ontologyRefactoring(IRI refactoredOntologyIRI, IRI datasetURI, IRI recipeIRI) throws RefactoringException,
+                                                                                             NoSuchRecipeException {
+
+        OWLOntology refactoredOntology = null;
+
+        ClerezzaOntologyStorage ontologyStorage = onManager.getOntologyStore();
+
+        Recipe recipe;
+        try {
+            recipe = ruleStore.getRecipe(recipeIRI);
+
+            RuleList kReSRuleList = recipe.getkReSRuleList();
+
+            OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
+
+            String fingerPrint = "";
+            for (Rule kReSRule : kReSRuleList) {
+                String sparql = kReSRule.toSPARQL();
+                OWLOntology refactoredDataSet = ontologyStorage
+                        .sparqlConstruct(sparql, datasetURI.toString());
+
+                ByteArrayOutputStream out = new ByteArrayOutputStream();
+                try {
+                    ontologyManager.saveOntology(refactoredDataSet, new RDFXMLOntologyFormat(), out);
+                    if (refactoredOntologyIRI == null) {
+                        ByteArrayOutputStream fpOut = new ByteArrayOutputStream();
+                        fingerPrint += URIGenerator.createID("", fpOut.toByteArray());
+                    }
+
+                } catch (OWLOntologyStorageException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+
+                ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+
+                try {
+                    ontologyManager.loadOntologyFromOntologyDocument(in);
+                } catch (OWLOntologyCreationException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+
+            }
+
+            if (refactoredOntologyIRI == null) {
+                refactoredOntologyIRI = IRI.create(URIGenerator.createID("urn://", fingerPrint.getBytes()));
+            }
+            OWLOntologyMerger merger = new OWLOntologyMerger(ontologyManager);
+
+            try {
+
+                refactoredOntology = merger.createMergedOntology(ontologyManager, refactoredOntologyIRI);
+
+                ontologyStorage.store(refactoredOntology);
+
+            } catch (OWLOntologyCreationException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        } catch (NoSuchRecipeException e1) {
+            log.error("SemionRefactorer : No Such recipe in the KReS Rule Store", e1);
+            throw e1;
+        }
+
+        if (refactoredOntology == null) {
+            throw new RefactoringException();
+        }
+    }
+
+    @Override
+    public OWLOntology ontologyRefactoring(OWLOntology inputOntology, IRI recipeIRI) throws RefactoringException,
+                                                                                    NoSuchRecipeException {
+        OWLOntology refactoredOntology = null;
+
+        // JenaToOwlConvert jenaToOwlConvert = new JenaToOwlConvert();
+
+        // OntModel ontModel =
+        // jenaToOwlConvert.ModelOwlToJenaConvert(inputOntology, "RDF/XML");
+
+        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+
+        Recipe recipe;
+        try {
+            recipe = ruleStore.getRecipe(recipeIRI);
+
+            RuleList kReSRuleList = recipe.getkReSRuleList();
+            log.info("RULE LIST SIZE : " + kReSRuleList.size());
+
+            OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
+            OWLOntologyManager ontologyManager2 = OWLManager.createOWLOntologyManager();
+
+            MGraph unionMGraph = new SimpleMGraph();
+
+            MGraph mGraph = OWLAPIToClerezzaConverter.owlOntologyToClerezzaMGraph(inputOntology);
+
+            for (Rule kReSRule : kReSRuleList) {
+                String sparql = kReSRule.toSPARQL();
+                log.info("SPARQL : " + sparql);
+
+                Graph constructedGraph = null;
+
+                switch (kReSRule.getExpressiveness()) {
+                    case KReSCore:
+                        constructedGraph = kReSCoreOperation(sparql, mGraph);
+                        break;
+                    case ForwardChaining:
+                        ForwardChainingRefactoringGraph forwardChainingRefactoringGraph = forwardChainingOperation(
+                            sparql, mGraph);
+                        constructedGraph = forwardChainingRefactoringGraph.getOutputGraph();
+                        mGraph = forwardChainingRefactoringGraph.getInputGraph();
+                        break;
+                    case Reflexive:
+                        constructedGraph = kReSCoreOperation(sparql, unionMGraph);
+                        break;
+                    case SPARQLConstruct:
+                        constructedGraph = kReSCoreOperation(sparql, mGraph);
+                        break;
+                    case SPARQLDelete:
+                        constructedGraph = sparqlUpdateOperation(sparql, unionMGraph);
+                        break;
+                    case SPARQLDeleteData:
+                        constructedGraph = sparqlUpdateOperation(sparql, unionMGraph);
+                        break;
+                    default:
+                        break;
+                }
+
+                if (constructedGraph != null) {
+                    unionMGraph.addAll(constructedGraph);
+                }
+
+            }
+
+            refactoredOntology = OWLAPIToClerezzaConverter.clerezzaMGraphToOWLOntology(unionMGraph);
+
+        } catch (NoSuchRecipeException e1) {
+            e1.printStackTrace();
+            log.error("SemionRefactorer : No Such recipe in the KReS Rule Store", e1);
+            throw e1;
+        }
+
+        if (refactoredOntology == null) {
+            throw new RefactoringException();
+        } else {
+            return refactoredOntology;
+        }
+    }
+
+    private Graph kReSCoreOperation(String query, MGraph mGraph) {
+
+        /*
+         * 
+         * Graph constructedGraph = null; try { ConstructQuery constructQuery = (ConstructQuery)
+         * QueryParser.getInstance() .parse(query); constructedGraph = tcManager.executeSparqlQuery(
+         * constructQuery, mGraph);
+         * 
+         * } catch (ParseException e) { log.error(e.getMessage()); } catch (NoQueryEngineException e) {
+         * log.error(e.getMessage()); }
+         * 
+         * return constructedGraph;
+         */
+
+        Model model = JenaToClerezzaConverter.clerezzaMGraphToJenaModel(mGraph);
+
+        Query sparqlQuery = QueryFactory.create(query, Syntax.syntaxARQ);
+        QueryExecution qexec = QueryExecutionFactory.create(sparqlQuery, model);
+
+        return JenaToClerezzaConverter.jenaModelToClerezzaMGraph(qexec.execConstruct()).getGraph();
+
+    }
+
+    private ForwardChainingRefactoringGraph forwardChainingOperation(String query, MGraph mGraph) {
+
+        Graph graph = kReSCoreOperation(query, mGraph);
+
+        mGraph.addAll(graph);
+
+        return new ForwardChainingRefactoringGraph(mGraph, graph);
+    }
+
+    private Graph sparqlUpdateOperation(String query, MGraph mGraph) {
+        Model model = JenaToClerezzaConverter.clerezzaMGraphToJenaModel(mGraph);
+        UpdateAction.parseExecute(query, model);
+        return JenaToClerezzaConverter.jenaModelToClerezzaMGraph(model).getGraph();
+    }
+
+}
+
+class ForwardChainingRefactoringGraph {
+
+    private MGraph inputGraph;
+    private Graph outputGraph;
+
+    public ForwardChainingRefactoringGraph(MGraph inputGraph, Graph outputGraph) {
+        this.inputGraph = inputGraph;
+        this.outputGraph = outputGraph;
+    }
+
+    public MGraph getInputGraph() {
+        return inputGraph;
+    }
+
+    public Graph getOutputGraph() {
+        return outputGraph;
+    }
+
+}

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/resources/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/rmi.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/rmi.owl?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/rmi.owl (added)
+++ incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/rmi.owl Fri Apr  1 12:47:48 2011
@@ -0,0 +1,202 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE rdf:RDF [
+    <!ENTITY owl "http://www.w3.org/2002/07/owl#" >
+    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
+    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
+    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
+    <!ENTITY rmi "http://kres.iks-project.eu/ontology/meta/rmi.owl#" >
+    <!ENTITY sequence "http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#" >
+]>
+
+
+<rdf:RDF xmlns="http://kres.iks-project.eu/ontology/meta/rmi.owl#"
+     xml:base="http://kres.iks-project.eu/ontology/meta/rmi_config.owl"
+     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+     xmlns:sequence="http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#"
+     xmlns:owl="http://www.w3.org/2002/07/owl#"
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:rmi="http://kres.iks-project.eu/ontology/meta/rmi.owl#">
+    <owl:Ontology rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl">
+        <owl:imports rdf:resource="http://ontologydesignpatterns.org/ont/iks/kres/rmi.owl"/>
+    </owl:Ontology>
+    
+
+
+    <!-- 
+    ///////////////////////////////////////////////////////////////////////////////////////
+    //
+    // Object Properties
+    //
+    ///////////////////////////////////////////////////////////////////////////////////////
+     -->
+
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#endWith -->
+
+    <owl:ObjectProperty rdf:about="&rmi;endWith"/>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#hasRule -->
+
+    <owl:ObjectProperty rdf:about="&rmi;hasRule"/>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#startWith -->
+
+    <owl:ObjectProperty rdf:about="&rmi;startWith"/>
+    
+
+
+    <!-- http://www.ontologydesignpatterns.org/cp/owl/sequence.owl#directlyPrecedes -->
+
+    <owl:ObjectProperty rdf:about="&sequence;directlyPrecedes"/>
+    
+
+
+    <!-- 
+    ///////////////////////////////////////////////////////////////////////////////////////
+    //
+    // Data properties
+    //
+    ///////////////////////////////////////////////////////////////////////////////////////
+     -->
+
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#hasBodyAndHead -->
+
+    <owl:DatatypeProperty rdf:about="&rmi;hasBodyAndHead"/>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#hasDescription -->
+
+    <owl:DatatypeProperty rdf:about="&rmi;hasDescription"/>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#hasSequence -->
+
+    <owl:DatatypeProperty rdf:about="&rmi;hasSequence"/>
+    
+
+
+    <!-- 
+    ///////////////////////////////////////////////////////////////////////////////////////
+    //
+    // Classes
+    //
+    ///////////////////////////////////////////////////////////////////////////////////////
+     -->
+
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#KReSRule -->
+
+    <owl:Class rdf:about="&rmi;KReSRule"/>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi.owl#Recipe -->
+
+    <owl:Class rdf:about="&rmi;Recipe"/>
+    
+
+
+    <!-- 
+    ///////////////////////////////////////////////////////////////////////////////////////
+    //
+    // Individuals
+    //
+    ///////////////////////////////////////////////////////////////////////////////////////
+     -->
+
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRecipeA -->
+
+    <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRecipeA">
+        <rdf:type rdf:resource="&rmi;Recipe"/>
+        <rmi:hasDescription rdf:datatype="&xsd;string">Some description here</rmi:hasDescription>
+        <rmi:hasSequence rdf:datatype="&xsd;string">http://eu.iksproject.kres/KReSOntologyRules.owl#MyRuleB,http://eu.iksproject.kres/KReSOntologyRules.owl#MyRuleA</rmi:hasSequence>
+        <rmi:hasRule rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleA"/>
+        <rmi:endWith rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleA"/>
+        <rmi:hasRule rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleB"/>
+        <rmi:startWith rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleB"/>
+    </owl:NamedIndividual>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleA -->
+
+    <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleA">
+        <rdf:type rdf:resource="&rmi;KReSRule"/>
+        <rmi:hasDescription rdf:datatype="&xsd;string">An example of description for my rule A</rmi:hasDescription>
+        <rmi:hasBodyAndHead rdf:datatype="&xsd;string">BodyA -&gt; BodyB</rmi:hasBodyAndHead>
+    </owl:NamedIndividual>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleB -->
+
+    <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleB">
+        <rdf:type rdf:resource="&rmi;KReSRule"/>
+        <rmi:hasDescription rdf:datatype="&xsd;string">An example of description..for my rule B</rmi:hasDescription>
+        <rmi:hasBodyAndHead rdf:datatype="&xsd;string">BodyB -&gt; HeadB</rmi:hasBodyAndHead>
+        <sequence:directlyPrecedes rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyRuleA"/>
+    </owl:NamedIndividual>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi_config.owl#ProvaParentRecipe -->
+
+    <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#ProvaParentRecipe">
+        <rdf:type rdf:resource="&rmi;Recipe"/>
+        <rmi:hasDescription rdf:datatype="&xsd;string">A single rule recipe.</rmi:hasDescription>
+        <rmi:hasSequence rdf:datatype="&xsd;string">http://kres.iks-project.eu/ontology/meta/rmi.owl#ProvaParentRule</rmi:hasSequence>
+        <rmi:endWith rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#ProvaParentRule"/>
+        <rmi:hasRule rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#ProvaParentRule"/>
+        <rmi:startWith rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#ProvaParentRule"/>
+    </owl:NamedIndividual>
+    
+    
+    <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyTestRecipe">
+        <rdf:type rdf:resource="&rmi;Recipe"/>
+        <rmi:hasDescription rdf:datatype="&xsd;string">Test recipe</rmi:hasDescription>
+        <rmi:hasSequence rdf:datatype="&xsd;string">http://kres.iks-project.eu/ontology/meta/rmi.owl#TestRule</rmi:hasSequence>
+        <rmi:endWith rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#TestRule"/>
+        <rmi:hasRule rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#TestRule"/>
+        <rmi:startWith rdf:resource="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#TestRule"/>
+    </owl:NamedIndividual>
+    
+
+
+    <!-- http://kres.iks-project.eu/ontology/meta/rmi_config.owl#ProvaParentRule -->
+
+    <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#ProvaParentRule">
+        <rdf:type rdf:resource="&rmi;KReSRule"/>
+        <rmi:hasDescription rdf:datatype="&xsd;string">A rule to inference if a person has an uncle.</rmi:hasDescription>
+        <rmi:hasBodyAndHead rdf:datatype="&xsd;string">ProvaParent = &lt;http://www.semanticweb.org/ontologies/2010/6/ProvaParent.owl#&gt; . rule1[ has(ProvaParent:hasParent, ?x, ?y) . has(ProvaParent:hasBrother, ?y, ?z) -&gt; has(ProvaParent:hasUncle, ?x, ?z) ]</rmi:hasBodyAndHead>
+    </owl:NamedIndividual>
+    
+    <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/meta/rmi_config.owl#TestRule">
+        <rdf:type rdf:resource="&rmi;KReSRule"/>
+        <rmi:hasDescription rdf:datatype="&xsd;string">A rule to infer that a kres person is a foaf person.</rmi:hasDescription>
+        <rmi:hasBodyAndHead rdf:datatype="&xsd;string">kres = &lt;http://kres.iks-project.eu/ontology.owl#&gt; . foaf = &lt;http://xmlns.com/foaf/0.1/&gt; . rule1[ is(kres:Person, ?x) -&gt; is(foaf:Person, ?x) ]</rmi:hasBodyAndHead>
+    </owl:NamedIndividual>
+</rdf:RDF>
+
+
+
+<!-- Generated by the OWL API (version 3.0.0.1451) http://owlapi.sourceforge.net -->
+

Added: incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/testKReSOnt.owl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/testKReSOnt.owl?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/testKReSOnt.owl (added)
+++ incubator/stanbol/trunk/rules/refactor/src/main/resources/META-INF/test/testKReSOnt.owl Fri Apr  1 12:47:48 2011
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+
+
+<!DOCTYPE rdf:RDF [
+    <!ENTITY kres "http://kres.iks-project.eu/ontology.owl#" >
+]>
+
+<rdf:RDF xmlns="http://kres.iks-project.eu/ontology/test.owl#"
+     xml:base="http://kres.iks-project.eu/ontology/test.owl"
+     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+     xmlns:owl="http://www.w3.org/2002/07/owl#"
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:kres="http://kres.iks-project.eu/ontology.owl#">
+     
+     <owl:NamedIndividual rdf:about="http://kres.iks-project.eu/ontology/test.owl#TestPerson">
+        <rdf:type rdf:resource="&kres;Person"/>
+    </owl:NamedIndividual>
+</rdf:RDF>
+

Propchange: incubator/stanbol/trunk/rules/refactor/src/test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/test/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/test/java/org/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/stanbol/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/stanbol/rules/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Propchange: incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/stanbol/rules/refactor/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target

Added: incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/stanbol/rules/refactor/RefactoringTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/stanbol/rules/refactor/RefactoringTest.java?rev=1087688&view=auto
==============================================================================
--- incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/stanbol/rules/refactor/RefactoringTest.java (added)
+++ incubator/stanbol/trunk/rules/refactor/src/test/java/org/apache/stanbol/rules/refactor/RefactoringTest.java Fri Apr  1 12:47:48 2011
@@ -0,0 +1,244 @@
+package org.apache.stanbol.rules.refactor;
+
+import static org.junit.Assert.fail;
+
+import java.io.InputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Set;
+
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
+import org.apache.clerezza.rdf.core.serializedform.Serializer;
+import org.apache.clerezza.rdf.core.sparql.QueryEngine;
+import org.apache.clerezza.rdf.jena.sparql.JenaSparqlEngine;
+import org.apache.clerezza.rdf.simple.storage.SimpleTcProvider;
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.impl.ONManagerImpl;
+import org.apache.stanbol.rules.base.api.NoSuchRecipeException;
+import org.apache.stanbol.rules.base.api.Recipe;
+import org.apache.stanbol.rules.base.api.Rule;
+import org.apache.stanbol.rules.base.api.RuleStore;
+import org.apache.stanbol.rules.base.api.util.RecipeList;
+import org.apache.stanbol.rules.base.api.util.RuleList;
+import org.apache.stanbol.rules.manager.changes.RecipeImpl;
+import org.apache.stanbol.rules.manager.parse.RuleParserImpl;
+import org.apache.stanbol.rules.refactor.api.Refactorer;
+import org.apache.stanbol.rules.refactor.api.RefactoringException;
+import org.apache.stanbol.rules.refactor.impl.RefactorerImpl;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLDataFactory;
+import org.semanticweb.owlapi.model.OWLDataProperty;
+import org.semanticweb.owlapi.model.OWLIndividual;
+import org.semanticweb.owlapi.model.OWLLiteral;
+import org.semanticweb.owlapi.model.OWLObjectProperty;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.semanticweb.owlapi.model.OWLOntologyStorageException;
+
+public class RefactoringTest {
+
+    static RuleStore ruleStore;
+    static OWLOntology ontology;
+    static IRI recipeIRI;
+
+    @BeforeClass
+    public static void setup() {
+
+        recipeIRI = IRI.create("http://kres.iks-project.eu/ontology/meta/rmi_config.owl#MyTestRecipe");
+
+        InputStream ontologyStream = RefactoringTest.class
+                .getResourceAsStream("/META-INF/test/testKReSOnt.owl");
+        InputStream recipeStream = RefactoringTest.class.getResourceAsStream("/META-INF/test/rmi.owl");
+
+        try {
+            final OWLOntology recipeModel = OWLManager.createOWLOntologyManager()
+                    .loadOntologyFromOntologyDocument(recipeStream);
+            ontology = OWLManager.createOWLOntologyManager().loadOntologyFromOntologyDocument(ontologyStream);
+
+            ruleStore = new RuleStore() {
+
+                @Override
+                public void setStore(OWLOntology owl) {
+                    // TODO Auto-generated method stub
+
+                }
+
+                @Override
+                public void saveOntology() throws OWLOntologyStorageException {
+                    // TODO Auto-generated method stub
+
+                }
+
+                @Override
+                public RecipeList listRecipes() {
+                    // TODO Auto-generated method stub
+                    return null;
+                }
+
+                @Override
+                public Set<IRI> listIRIRecipes() {
+                    // TODO Auto-generated method stub
+                    return null;
+                }
+
+                @Override
+                public String getRuleStoreNamespace() {
+                    // TODO Auto-generated method stub
+                    return null;
+                }
+
+                @Override
+                public Recipe getRecipe(IRI recipeIRI) throws NoSuchRecipeException {
+                    Recipe recipe = null;
+
+                    if (recipeIRI != null) {
+                        OWLDataFactory factory = OWLManager.getOWLDataFactory();
+                        OWLIndividual recipeIndividual = factory.getOWLNamedIndividual(recipeIRI);
+                        if (recipeIndividual != null) {
+                            String ruleNS = "http://kres.iks-project.eu/ontology/meta/rmi.owl#";
+
+                            /**
+                             * First get the recipe description in the rule/recipe ontology.
+                             */
+                            OWLDataProperty hasDescription = factory.getOWLDataProperty(IRI
+                                    .create(ruleNS + "hasDescription"));
+
+                            String recipeDescription = null;
+
+                            Set<OWLLiteral> descriptions = recipeIndividual.getDataPropertyValues(
+                                hasDescription, recipeModel);
+                            for (OWLLiteral description : descriptions) {
+                                recipeDescription = description.getLiteral();
+                            }
+
+                            /**
+                             * Then retrieve the rules associated to the recipe in the rule store.
+                             */
+                            OWLObjectProperty objectProperty = factory.getOWLObjectProperty(IRI
+                                    .create(ruleNS + "hasRule"));
+                            Set<OWLIndividual> rules = recipeIndividual.getObjectPropertyValues(
+                                objectProperty, recipeModel);
+
+                            String kReSRulesInKReSSyntax = "";
+
+                            /**
+                             * Fetch the rule content expressed as a literal in Rule Syntax.
+                             */
+                            OWLDataProperty hasBodyAndHead = factory.getOWLDataProperty(IRI
+                                    .create(ruleNS + "hasBodyAndHead"));
+                            for (OWLIndividual rule : rules) {
+
+                                Set<OWLLiteral> kReSRuleLiterals = rule.getDataPropertyValues(hasBodyAndHead,
+                                    recipeModel);
+
+                                for (OWLLiteral kReSRuleLiteral : kReSRuleLiterals) {
+                                    String ruleTmp = kReSRuleLiteral.getLiteral().replace("&lt;", "<");
+                                    ruleTmp = ruleTmp.replace("&gt;", ">");
+                                    kReSRulesInKReSSyntax += ruleTmp + System.getProperty("line.separator");
+                                }
+                            }
+
+                            /**
+                             * Create the Recipe object.
+                             */
+
+                            RuleList ruleList = RuleParserImpl.parse(kReSRulesInKReSSyntax).getkReSRuleList();
+                            recipe = new RecipeImpl(recipeIRI, recipeDescription, ruleList);
+                        } else {
+                            throw new NoSuchRecipeException(recipeIRI);
+                        }
+                    }
+
+                    return recipe;
+                }
+
+                @Override
+                public OWLOntology getOntology() {
+                    // TODO Auto-generated method stub
+                    return null;
+                }
+
+                @Override
+                public String getFilePath() {
+                    // TODO Auto-generated method stub
+                    return null;
+                }
+
+                @Override
+                public boolean addRecipe(IRI recipeIRI, String recipeDescription) {
+                    // TODO Auto-generated method stub
+                    return false;
+                }
+
+                @Override
+                public Recipe addRuleToRecipe(String recipeID, String kReSRuleInKReSSyntax) throws NoSuchRecipeException {
+                    return null;
+
+                }
+
+                @Override
+                public Recipe addRuleToRecipe(Recipe recipe, String kReSRuleInKReSSyntax) {
+                    return null;
+                    // TODO Auto-generated method stub
+
+                }
+
+                @Override
+                public void createRecipe(String recipeID, String rulesInKReSSyntax) {
+                    // TODO Auto-generated method stub
+
+                }
+
+                @Override
+                public boolean removeRecipe(Recipe recipe) {
+                    throw new UnsupportedOperationException("Not supported yet.");
+                }
+
+                @Override
+                public boolean removeRecipe(IRI recipeIRI) {
+                    throw new UnsupportedOperationException("Not supported yet.");
+                }
+
+                @Override
+                public boolean removeRule(Rule rule) {
+                    throw new UnsupportedOperationException("Not supported yet.");
+                }
+            };
+        } catch (OWLOntologyCreationException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void refactoringTest() throws Exception {
+        Dictionary<String,Object> emptyConfig = new Hashtable<String,Object>();
+
+        class SpecialTcManager extends TcManager {
+            public SpecialTcManager(QueryEngine qe, WeightedTcProvider wtcp) {
+                super();
+                bindQueryEngine(qe);
+                bindWeightedTcProvider(wtcp);
+            }
+        }
+
+        QueryEngine qe = new JenaSparqlEngine();
+        WeightedTcProvider wtcp = new SimpleTcProvider();
+        TcManager tcm = new SpecialTcManager(qe, wtcp);
+
+        ONManager onm = new ONManagerImpl(tcm, wtcp, emptyConfig);
+        Refactorer refactorer = new RefactorerImpl(null, new Serializer(), tcm, onm, ruleStore, emptyConfig);
+        try {
+            refactorer.ontologyRefactoring(ontology, recipeIRI);
+        } catch (RefactoringException e) {
+            fail("Error while refactoring.");
+        } catch (NoSuchRecipeException e) {
+            fail("Error while refactoring: no such recipe");
+        }
+    }
+
+}

Propchange: incubator/stanbol/trunk/rules/web/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Apr  1 12:47:48 2011
@@ -0,0 +1 @@
+target