You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by al...@apache.org on 2012/02/03 18:54:01 UTC

svn commit: r1240263 [1/6] - in /incubator/stanbol/branches/ontonet-showcase/explanation: ./ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/org/ core/src/main/java/org/apache/ core/src/main/java/org/apache/stanbol/ core/src/main/...

Author: alexdma
Date: Fri Feb  3 17:53:57 2012
New Revision: 1240263

URL: http://svn.apache.org/viewvc?rev=1240263&view=rev
Log:
STANBOL-347 : moving explanation to ontonet showcase branch

Added:
    incubator/stanbol/branches/ontonet-showcase/explanation/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/   (with props)
    incubator/stanbol/branches/ontonet-showcase/explanation/core/pom.xml
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/Activator.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/BinaryRelation.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/CompatibilityMapping.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Configuration.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explainable.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explanation.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationGenerator.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationTypes.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/InteractionPatterns.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/KnowledgeItem.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Path.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Schema.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalog.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalogManager.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaMatcher.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/heuristics/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ClerezzaSchemaMatcher.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/EntityHubSchemaMatcher.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationEnvironmentConfiguration.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationGeneratorImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/KnowledgeItemImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/PathImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogManagerImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/BinaryRelationImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/ClerezzaSchemaMatcherImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/CompatibilityMappingImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/PathConstructor.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/schema/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/schema/SchemaExtractor.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/util/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/util/SimpleOWLUtils.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/OSGI-INF/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/OSGI-INF/metatype/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/OSGI-INF/metatype/metatype.properties
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/data/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/data/revyu_sparql-20k.rdf
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/log4j.properties
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/context.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/explbase.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/base.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/catalog-v001.xml
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/interpretation.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/patterns/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/patterns/catalog-v001.xml
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/patterns/cms.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/interaction/patterns/recommendation.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/model/ipc.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/schemas/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/schemas/explanationschema.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/schemas/organizationalhierarchy.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/schemas/organizationalhierarchy_mappings.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/schemas/registry/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/schemas/registry/explanation-mappings.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/resources/schemas/registry/explanation.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/stanbol/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/stanbol/explanation/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/stanbol/explanation/Data.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/stanbol/explanation/MockOsgiContext.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/stanbol/explanation/impl/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/stanbol/explanation/impl/TestGenerator.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/java/org/apache/stanbol/explanation/impl/TestSchemaMatchers.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/ontologies/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/ontologies/abox/
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/ontologies/abox/catalog-v001.xml
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/ontologies/abox/cms.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/ontologies/explanation_testdata.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/ontologies/index.rdf
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/test/resources/ontologies/org.owl
    incubator/stanbol/branches/ontonet-showcase/explanation/pom.xml   (with props)
    incubator/stanbol/branches/ontonet-showcase/explanation/web/   (with props)
    incubator/stanbol/branches/ontonet-showcase/explanation/web/pom.xml
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/apache/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/apache/stanbol/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/apache/stanbol/explanation/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/apache/stanbol/explanation/web/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/apache/stanbol/explanation/web/ExplanationWebFragment.java
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/apache/stanbol/explanation/web/resource/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/java/org/apache/stanbol/explanation/web/resource/ExplanationResource.java
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/stanbol/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/stanbol/explanation/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/stanbol/explanation/web/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/stanbol/explanation/web/resource/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/stanbol/explanation/web/resource/ExplanationResource/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/stanbol/explanation/web/resource/ExplanationResource/index.ftl
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/main/resources/org/apache/stanbol/explanation/web/templates/org/apache/stanbol/explanation/web/resource/ExplanationResource/webview.ftl
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/test/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/test/java/
    incubator/stanbol/branches/ontonet-showcase/explanation/web/src/test/resources/

Propchange: incubator/stanbol/branches/ontonet-showcase/explanation/core/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb  3 17:53:57 2012
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/pom.xml?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/pom.xml (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/pom.xml Fri Feb  3 17:53:57 2012
@@ -0,0 +1,193 @@
+<?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>0.9.0-incubating-SNAPSHOT</version>
+		<relativePath>../../parent</relativePath>
+	</parent>
+
+	<groupId>org.apache.stanbol</groupId>
+	<artifactId>org.apache.stanbol.explanation.core</artifactId>
+	<packaging>bundle</packaging>
+
+	<name>Apache Stanbol Explanation Engine</name>
+	<description>
+		Generator for user-sensitive explanations of system feedback.
+	</description>
+
+	<inceptionYear>2011</inceptionYear>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Bundle-Activator>
+							org.apache.stanbol.explanation.Activator
+						</Bundle-Activator>
+						<Export-Package>
+							org.apache.stanbol.explanation.*
+						</Export-Package>
+						<Import-Package>
+							org.slf4j.*,
+							*
+						</Import-Package>
+						<Private-Package />
+						<!-- We need to provide the default schemas to 
+							the DataFileProvider infrastructure -->
+						<Data-Files>data,schemas,schemas/registry</Data-Files>
+						<Data-Files-Priority>
+							-100
+						</Data-Files-Priority>
+						<_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>
+
+
+	<dependencies>
+
+		<!-- OSGi deps -->
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.compendium</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.scr.annotations</artifactId>
+		</dependency>
+
+		<!-- Persistence deps -->
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.jena.parser</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.jena.serializer</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.jena.sparql</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.simple.storage</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.utils</artifactId>
+		</dependency>
+
+		<!-- Stanbol infrastructure deps -->
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.commons.stanboltools.datafileprovider</artifactId>
+		</dependency>
+
+		<!-- Stanbol knowledge management deps -->
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.entityhub.servicesapi</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.ontologymanager.ontonet</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.ontologymanager.registry</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.owl</artifactId>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.rules.manager</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+
+		<!-- Testing deps -->
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.jena.parser</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.jena.serializer</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.rdfjson</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>rdf.simple.storage</artifactId>
+			<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>

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/Activator.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/Activator.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/Activator.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/Activator.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,22 @@
+package org.apache.stanbol.explanation;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Activator implements BundleActivator {
+
+    private Logger log = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public void start(BundleContext context) throws Exception {
+        log.info("Apache Stanbol Explanation engine OSGi bundle activated");
+    }
+
+    @Override
+    public void stop(BundleContext context) throws Exception {
+        log.info("Apache Stanbol Explanation engine OSGi bundle deactivated");
+    }
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/BinaryRelation.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/BinaryRelation.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/BinaryRelation.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/BinaryRelation.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.api;
+
+public interface BinaryRelation {
+
+    String getFrom();
+
+    String getProperty();
+
+    String getTo();
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/CompatibilityMapping.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/CompatibilityMapping.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/CompatibilityMapping.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/CompatibilityMapping.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.api;
+
+public interface CompatibilityMapping {
+
+    double getLikelihood();
+
+    Path getPath();
+
+    BinaryRelation getRelation();
+
+    void setLikelihood(double likelihood);
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Configuration.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Configuration.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Configuration.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,28 @@
+package org.apache.stanbol.explanation.api;
+
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+
+/**
+ * This object contains every shared information that other components need to know in order to work. It
+ * should be the primary object referenced by service components and passed as an argument to non-default
+ * constructors.
+ * 
+ * @author alexdma
+ * 
+ */
+public interface Configuration {
+
+    /**
+     * The key used to configure the path of the ontology network configuration.
+     */
+    String SCOPE_SHORT_ID = "org.apache.stanbol.explanation.scopeid";
+
+    ONManager getOntologyNetworkManager();
+
+    String getScopeID();
+    
+    String getScopeShortId();
+    
+    
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explainable.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explainable.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explainable.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explainable.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,23 @@
+package org.apache.stanbol.explanation.api;
+
+/**
+ * An umbrella and wrapper type for any object that may be backed up by a user-sensitive explanation.
+ * 
+ * @author alexdma
+ * 
+ */
+public interface Explainable<T> {
+    
+    public static final int FACT = 2;
+    
+    public static final int KNOWLEDGE_ITEM = 1;
+    
+    public static final int DISCOURSE_ITEM = 3;
+
+    /**
+     * 
+     * @return the referenced object.
+     */
+    T getItem();
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explanation.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explanation.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explanation.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Explanation.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,32 @@
+package org.apache.stanbol.explanation.api;
+
+import java.util.Collection;
+
+/**
+ * A knowledge object that incorporates a description, or justification, for another knowledge object, be it a
+ * content item, fact, event or collection thereof.
+ * 
+ * @author alexdma
+ * 
+ */
+public interface Explanation {
+
+    /**
+     * 
+     * @return the object being explained.
+     */
+    Explainable<?> getObject();
+
+    /**
+     * 
+     * @return the items that can be assembled for rendering the explanation.
+     */
+    Collection<?> getGrounding();
+    
+    /**
+     * 
+     * @return the nature of this explanation object.
+     */
+    ExplanationTypes getType();
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationGenerator.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationGenerator.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationGenerator.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationGenerator.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,28 @@
+package org.apache.stanbol.explanation.api;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.semanticweb.owlapi.model.OWLAxiom;
+
+/**
+ * A factory for explanation information objects.
+ * 
+ * @author alexdma
+ * 
+ */
+public interface ExplanationGenerator {
+
+    /**
+     * Creates a new explanation.
+     * 
+     * @param item
+     * @param type
+     * @param grounds
+     * @return
+     */
+    Explanation createExplanation(Explainable<?> item, ExplanationTypes type, Set<? extends OWLAxiom> grounds);
+
+    Set<URI> getRelations(URI from, URI to, int length, String sessionId);
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationTypes.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationTypes.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationTypes.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/ExplanationTypes.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,8 @@
+package org.apache.stanbol.explanation.api;
+
+public enum ExplanationTypes {
+
+    KNOWLEDGE_OBJECT_SYNOPSIS,
+    UI_FEEDBACK_JUSTIFICATION;
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/InteractionPatterns.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/InteractionPatterns.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/InteractionPatterns.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/InteractionPatterns.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,17 @@
+package org.apache.stanbol.explanation.api;
+
+/**
+ * Interaction patterns known or supported for explanation;
+ * 
+ * @author alexdma
+ *
+ */
+public enum InteractionPatterns {
+
+    ANNOTATION,
+    DISAMBIGUATION,
+    DRAG_N_DROP,
+    RECOMMENDATION,
+    SEARCH;
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/KnowledgeItem.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/KnowledgeItem.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/KnowledgeItem.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/KnowledgeItem.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,5 @@
+package org.apache.stanbol.explanation.api;
+
+public interface KnowledgeItem extends Explainable<Object> {
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Path.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Path.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Path.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Path.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.api;
+
+import java.util.List;
+
+import org.apache.clerezza.rdf.core.Triple;
+
+public interface Path extends List<Triple> {
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Schema.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Schema.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Schema.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/Schema.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,15 @@
+package org.apache.stanbol.explanation.api;
+
+import org.semanticweb.owlapi.model.IRI;
+
+/**
+ * A cognitive schema, linguistic frame or knowledge pattern.
+ * 
+ * @author alexdma
+ *
+ */
+public interface Schema {
+
+    public IRI getID();
+    
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalog.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalog.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalog.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalog.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,80 @@
+package org.apache.stanbol.explanation.api;
+
+import java.util.Set;
+
+import org.semanticweb.owlapi.model.IRI;
+
+/**
+ * A registry of knowledge schemas to be matched against in order to filter relevant statements for
+ * explanations.
+ * 
+ * @author alexdma
+ * 
+ */
+public interface SchemaCatalog {
+
+    public static final String CUSTOM_SCHEMAS = "org.apache.stanbol.explanation.schema.catalog.customschemas";
+    
+    public static final String ID = "org.apache.stanbol.explanation.schema.catalog.id";
+
+    public static final String LOCATION = "org.apache.stanbol.explanation.schema.catalog.location";
+
+    /**
+     * Adds or updates a schema in the catalog. If the exact same or an equal schema is already present in the
+     * catalog, no action is taken. If a different schema with the same ID is present, it will be replaced.
+     * 
+     * @param schema
+     */
+    void addSchema(Schema schema);
+
+    /**
+     * Removes all schemas from the catalog.
+     */
+    void clearSchems();
+
+    /**
+     * Returns the catalog identifier.
+     * 
+     * @return the catalog identifier.
+     */
+    String getId();
+
+    /**
+     * 
+     * @param schemaID
+     * @return the requested schema, or null if not present.
+     */
+    Schema getSchema(IRI schemaID);
+
+    /**
+     * Returns all the schemas in the catalog.
+     * 
+     * @return
+     */
+    Set<Schema> getSchemas();
+
+    /**
+     * Determines if a schema with the given ID is already present in the catalog.
+     * 
+     * @param schemaID
+     * @return true if a schema with <code>schemaID</code> is present, false otherwise.
+     */
+    boolean hasSchema(IRI schemaID);
+
+    /**
+     * Removes any schema whose ID is equal to the supplied one. If no such schema is present, no action is
+     * taken.
+     * 
+     * @param schemaId
+     */
+    void removeSchema(IRI schemaId);
+
+    /**
+     * Tries to remove. Note that if a schema with the same ID as the supplied one, but which is not
+     * equivalent by {@link Object#equals(Object)}, is found, it will not be removed. To ensure that any
+     * schema with that ID is removed, use {@link #removeSchema(IRI)}.
+     * 
+     * @param schema
+     */
+    void removeSchema(Schema schema);
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalogManager.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalogManager.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalogManager.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaCatalogManager.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,20 @@
+package org.apache.stanbol.explanation.api;
+
+import java.util.Set;
+
+public interface SchemaCatalogManager {
+
+    String CATALOG_LOCATIONS = "org.apache.stanbol.explanation.catalogs";
+
+    void addCatalog(SchemaCatalog catalog);
+
+    /**
+     * Returns the set of <i>loaded</i> schema catalogs.
+     * 
+     * @return
+     */
+    Set<SchemaCatalog> getCatalogs();
+
+    void removeCatalog(String id);
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaMatcher.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaMatcher.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaMatcher.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/api/SchemaMatcher.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,22 @@
+package org.apache.stanbol.explanation.api;
+
+import java.util.Set;
+
+/**
+ * 
+ * @author alexdma
+ * 
+ * @param <E>
+ *            the entity to be matched against, or <i><explainable/i>
+ * @param <KB>
+ *            knowledge base
+ * @param <C>
+ *            schema library, or <i>catalog</i>.
+ */
+public interface SchemaMatcher<E,KB,C> {
+
+    void setKnowledgeBase(KB knowledgeBase);
+
+    Set<Schema> getSatisfiableSchemas(Set<C> catalogs, E entity);
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ClerezzaSchemaMatcher.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ClerezzaSchemaMatcher.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ClerezzaSchemaMatcher.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ClerezzaSchemaMatcher.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.stanbol.explanation.api.SchemaMatcher;
+import org.apache.stanbol.ontologymanager.registry.api.model.Library;
+
+public interface ClerezzaSchemaMatcher extends SchemaMatcher<UriRef,Graph,Library> {
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/EntityHubSchemaMatcher.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/EntityHubSchemaMatcher.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/EntityHubSchemaMatcher.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/EntityHubSchemaMatcher.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import java.net.URI;
+
+import org.apache.stanbol.entityhub.servicesapi.site.ReferencedSiteManager;
+import org.apache.stanbol.explanation.api.SchemaMatcher;
+import org.apache.stanbol.ontologymanager.registry.api.model.Library;
+
+/**
+ * A {@link SchemaMatcher} that uses the Apache Stanbol Entity Hub as a knowledge base connector.
+ */
+public interface EntityHubSchemaMatcher extends SchemaMatcher<URI,ReferencedSiteManager,Library> {
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationEnvironmentConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationEnvironmentConfiguration.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationEnvironmentConfiguration.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationEnvironmentConfiguration.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,130 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import java.io.IOException;
+import java.util.Dictionary;
+
+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.ReferencePolicy;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.explanation.api.Configuration;
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Default implementation of the explanation environment configuration.
+ * 
+ */
+@Component(immediate = true, metatype = true)
+@Service(Configuration.class)
+public class ExplanationEnvironmentConfiguration implements Configuration {
+
+    public static final String _SCOPE_SHORT_ID_DEFAULT = "Explanation";
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference(policy = ReferencePolicy.DYNAMIC)
+    private ONManager onm;
+
+    @Property(name = Configuration.SCOPE_SHORT_ID, value = _SCOPE_SHORT_ID_DEFAULT)
+    private String scopeShortID;
+
+    /**
+     * 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 ExplanationGeneratorImpl instances do need to be
+     * configured! YOU NEED TO USE {@link #ExplanationEnvironmentConfiguration(ONManager, Dictionary)} or its
+     * overloads, to parse the configuration and then initialise the rule store if running outside an OSGI
+     * environment.
+     */
+    public ExplanationEnvironmentConfiguration() {
+        super();
+    }
+
+    /**
+     * To be invoked by non-OSGi environments.
+     * 
+     * @param onm
+     * @param configuration
+     */
+    public ExplanationEnvironmentConfiguration(ONManager onm, Dictionary<String,Object> configuration) {
+        this();
+        this.onm = onm;
+        try {
+            activate(configuration);
+        } catch (IOException e) {
+            log.error("Unable to access servlet context.", e);
+        }
+    }
+
+    /**
+     * Used to configure an instance within an OSGi container.
+     * 
+     * @throws IOException
+     *             if there is no valid component context.
+     */
+    @SuppressWarnings("unchecked")
+    @Activate
+    protected void activate(ComponentContext context) throws IOException {
+        log.info("in " + Configuration.class + " activate with context " + context);
+        if (context == null) {
+            throw new IllegalStateException("No valid" + ComponentContext.class + " parsed in activate!");
+        }
+        activate((Dictionary<String,Object>) context.getProperties());
+    }
+
+    /**
+     * Called within both OSGi and non-OSGi environments.
+     * 
+     * @param configuration
+     * @throws IOException
+     */
+    protected void activate(Dictionary<String,Object> configuration) throws IOException {
+
+        this.scopeShortID = (String) configuration.get(Configuration.SCOPE_SHORT_ID);
+        if (this.scopeShortID == null) this.scopeShortID = _SCOPE_SHORT_ID_DEFAULT;
+    }
+
+    @Deactivate
+    protected void deactivate(ComponentContext context) {
+        log.info("in " + Configuration.class + " deactivate with context " + context);
+    }
+
+    @Override
+    public ONManager getOntologyNetworkManager() {
+        return onm;
+    }
+
+    @Override
+    public String getScopeID() {
+        return scopeShortID;
+    }
+
+    @Override
+    public String getScopeShortId() {
+        return scopeShortID;
+    }
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationGeneratorImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationGeneratorImpl.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationGeneratorImpl.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationGeneratorImpl.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,289 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Dictionary;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.rdf.core.TripleCollection;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.clerezza.rdf.core.sparql.ParseException;
+import org.apache.clerezza.rdf.core.sparql.QueryParser;
+import org.apache.clerezza.rdf.core.sparql.ResultSet;
+import org.apache.clerezza.rdf.core.sparql.SolutionMapping;
+import org.apache.clerezza.rdf.core.sparql.query.Query;
+import org.apache.clerezza.rdf.core.sparql.query.Variable;
+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.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileProvider;
+import org.apache.stanbol.explanation.api.Configuration;
+import org.apache.stanbol.explanation.api.Explainable;
+import org.apache.stanbol.explanation.api.Explanation;
+import org.apache.stanbol.explanation.api.ExplanationGenerator;
+import org.apache.stanbol.explanation.api.ExplanationTypes;
+import org.apache.stanbol.explanation.api.KnowledgeItem;
+import org.apache.stanbol.explanation.impl.clerezza.PathConstructor;
+import org.apache.stanbol.ontologymanager.ontonet.api.DuplicateIDException;
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.io.BlankOntologySource;
+import org.apache.stanbol.ontologymanager.ontonet.api.io.GraphContentInputSource;
+import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
+import org.apache.stanbol.ontologymanager.ontonet.api.io.RootOntologyIRISource;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyScope;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologySpace;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.UnmodifiableOntologyCollectorException;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.Session;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.SessionManager;
+import org.osgi.service.component.ComponentContext;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLAxiom;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * TODO Update the merged ontology as a background job.
+ * 
+ * @author alessandro
+ * 
+ */
+@Component(immediate = true, metatype = true)
+@Service(ExplanationGenerator.class)
+public class ExplanationGeneratorImpl implements ExplanationGenerator {
+
+    private static final String _EXPLANATION_SCHEMA = "http://ontologydesignpatterns.org/schemas/explanationschema.owl";
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    private Configuration config;
+
+    @Reference
+    private ONManager onm;
+
+    @Reference
+    private SessionManager sesMgr;
+
+    @Reference
+    private DataFileProvider dataFileProvider;
+
+    @Reference
+    private QueryParser queryParser;
+
+    @Reference
+    private TcManager tcManager;
+
+    private OntologyScope scope;
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    /**
+     * 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 ExplanationGeneratorImpl instances do need to be
+     * configured! YOU NEED TO USE {@link #ExplanationGeneratorImpl(ONManager, DataFileProvider, Dictionary)}
+     * or its overloads, to parse the configuration and then initialise the rule store if running outside an
+     * OSGI environment.
+     */
+    public ExplanationGeneratorImpl() {
+        super();
+    }
+
+    /**
+     * To be invoked by non-OSGi environments.
+     * 
+     * @param onManager
+     * @param config
+     * @param dataFileProvider
+     * @param configuration
+     */
+    public ExplanationGeneratorImpl(Configuration config,
+                                    DataFileProvider dataFileProvider,
+                                    Dictionary<String,Object> configuration) {
+        this();
+        this.config = config;
+        this.onm = config.getOntologyNetworkManager();
+        this.dataFileProvider = dataFileProvider;
+        try {
+            activate(configuration);
+        } catch (IOException e) {
+            log.error("Unable to access servlet context.", e);
+        }
+    }
+
+    /**
+     * Used to configure an instance within an OSGi container.
+     * 
+     * @throws IOException
+     */
+    @SuppressWarnings("unchecked")
+    @Activate
+    protected void activate(ComponentContext context) throws IOException {
+        log.info("in " + ExplanationGeneratorImpl.class + " activate with context " + context);
+        if (context == null) {
+            throw new IllegalStateException("No valid" + ComponentContext.class + " parsed in activate!");
+        }
+        activate((Dictionary<String,Object>) context.getProperties());
+    }
+
+    /**
+     * Called within both OSGi and non-OSGi environments.
+     * 
+     * @param configuration
+     * @throws IOException
+     */
+    protected void activate(Dictionary<String,Object> configuration) throws IOException {
+
+        // OntoNetSimulator sim = new OntoNetSimulator();
+        // Create and register the scope for explanations.
+        String scopeid = config.getScopeID();
+        try {
+            OntologyInputSource<?,?> coreSrc;
+            try {
+                coreSrc = new RootOntologyIRISource(IRI.create(_EXPLANATION_SCHEMA));
+            } catch (OWLOntologyCreationException e) {
+                coreSrc = new BlankOntologySource();
+            }
+            scope = onm.getOntologyScopeFactory().createOntologyScope(scopeid, coreSrc);
+            onm.getScopeRegistry().registerScope(scope, true);
+        } catch (DuplicateIDException e) {
+            log.warn("Cannot create scope {}. A scope with this ID is already registered.", scopeid);
+            scope = onm.getScopeRegistry().getScope(scopeid);
+        }
+        if (scope != null) {
+            try {
+                OntologySpace spc = scope.getCustomSpace();
+                spc.addOntology(new RootOntologyIRISource(IRI
+                        .create("http://xmlns.com/foaf/spec/20100809.rdf")));
+                spc.addOntology(new RootOntologyIRISource(IRI.create("http://vocab.org/review/terms.rdf")));
+            } catch (UnmodifiableOntologyCollectorException e) {
+                log.warn("Failed to load Revyu dataset into locked scope {}", scope);
+            } catch (OWLOntologyCreationException e) {
+                log.warn("Failed to load FOAF into locked scope {}", scope);
+            }
+        }
+
+        log.debug("Explanation Generator activated.");
+
+    }
+
+    @Override
+    public Explanation createExplanation(Explainable<?> item,
+                                         ExplanationTypes type,
+                                         Set<? extends OWLAxiom> grounds) {
+
+        Explanation result = new ExplanationImpl(item, type);
+
+        switch (type) {
+            case KNOWLEDGE_OBJECT_SYNOPSIS:
+                if (!(item instanceof KnowledgeItem)) break;
+                KnowledgeItem ki = (KnowledgeItem) item;
+                break;
+            case UI_FEEDBACK_JUSTIFICATION:
+                break;
+        }
+
+        return result;
+    }
+
+    /**
+     * Deactivation of the ONManagerImpl resets all its resources.
+     */
+    @Deactivate
+    protected void deactivate(ComponentContext context) {
+        log.info("in " + ExplanationGeneratorImpl.class + " deactivate with context " + context);
+    }
+
+    @Override
+    public Set<URI> getRelations(URI from, URI to, int length, String sessionId) {
+
+        Session ses = sesMgr.getSession(sessionId);
+
+        if (ses == null) {
+            log.warn("No session with id {}. Will get relations on scope only.");
+        } else {
+            System.out.println("Attaching " + scope + " to session " + ses);
+            ses.attachScope(scope);
+            System.out.println(ses + " has " + ses.getAttachedScopes().size() + " attached scopes.");
+
+            // Load the stuff to
+            String lookfor = "revyu_sparql-20k.rdf";
+            boolean hasRevyu = dataFileProvider.isAvailable(null, lookfor, null);
+            log.info("{} available? {}", lookfor, hasRevyu);
+
+            InputStream is;
+            try {
+                is = dataFileProvider.getInputStream(null, lookfor, null);
+                ses.addOntology(new GraphContentInputSource(is, tcManager));
+            } catch (IOException e) {
+                log.error("Failed to load Revyu dataset", e);
+            } catch (UnmodifiableOntologyCollectorException e) {
+                log.error("Failed to load Revyu dataset into unmodifiable session {}", ses);
+            }
+        }
+
+        // Graph g = (ses != null) ? ses.export(Graph.class, false) : scope.export(Graph.class, false);
+
+        Query q;
+        try {
+            // Using a StringBuffer because it will be dynamic one day
+            StringBuffer sparql = new StringBuffer("SELECT");
+            sparql.append(" ?x ?r ?y");
+            sparql.append(" WHERE");
+            sparql.append(" {");
+            sparql.append(" ?x ?r ?y .");
+            sparql.append(" }");
+            q = queryParser.parse(sparql.toString());
+
+            Set<TripleCollection> graphs = new HashSet<TripleCollection>();
+            if (ses != null) graphs.addAll(ses.getManagedOntologies(Graph.class, false));
+            // for (String id : ses.getAttachedScopes())
+            // graphs.add(onm.getScopeRegistry().getScope(id).export(Graph.class, true));
+
+//            for (TripleCollection g : graphs) {
+//                Object o = tcManager.executeSparqlQuery(q, g);
+//                if (o instanceof ResultSet) {
+//                    ResultSet result = (ResultSet) o;
+//                    while (result.hasNext()) {
+//                        SolutionMapping sm = result.next();
+//                        for (Variable key : sm.keySet())
+//                            System.out.println("##### " + key.getName() + " **** " + sm.get(key));
+//                    }
+//
+//                }
+//            }
+
+            PathConstructor.computePathCompatibility(new UriRef(from.toString()), to == null ? null
+                    : new UriRef(to.toString()), graphs, 3);
+
+        } catch (ParseException e) {
+            log.error("Could not execute SPARQL query.", e);
+        }
+
+        return null;
+    }
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationImpl.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationImpl.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationImpl.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import java.util.Collection;
+
+import org.apache.stanbol.explanation.api.Explainable;
+import org.apache.stanbol.explanation.api.Explanation;
+import org.apache.stanbol.explanation.api.ExplanationTypes;
+
+public class ExplanationImpl implements Explanation {
+
+    Explainable<?> object;
+
+    ExplanationTypes type;
+
+    public ExplanationImpl(Explainable<?> explainable, ExplanationTypes type) {
+        this.object = explainable;
+        this.type = type;
+    }
+
+    @Override
+    public Explainable<?> getObject() {
+        return object;
+    }
+
+    @Override
+    public Collection<?> getGrounding() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ExplanationTypes getType() {
+        return type;
+    }
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/KnowledgeItemImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/KnowledgeItemImpl.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/KnowledgeItemImpl.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/KnowledgeItemImpl.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,21 @@
+package org.apache.stanbol.explanation.impl;
+
+import org.apache.stanbol.explanation.api.KnowledgeItem;
+import org.apache.stanbol.explanation.util.SimpleOWLUtils;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLIndividual;
+
+public class KnowledgeItemImpl implements KnowledgeItem {
+
+    private OWLIndividual entity;
+
+    public KnowledgeItemImpl(IRI entityIri) {
+        this.entity = SimpleOWLUtils.getIndividual(entityIri);
+    }
+
+    @Override
+    public OWLIndividual getItem() {
+        return entity;
+    }
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/PathImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/PathImpl.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/PathImpl.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/PathImpl.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import java.util.ArrayList;
+
+import org.apache.clerezza.rdf.core.Triple;
+import org.apache.stanbol.explanation.api.Path;
+
+public class PathImpl extends ArrayList<Triple> implements Path {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -7334964669926149357L;
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogImpl.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogImpl.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogImpl.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,173 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.explanation.api.Configuration;
+import org.apache.stanbol.explanation.api.Schema;
+import org.apache.stanbol.explanation.api.SchemaCatalog;
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyScope;
+import org.osgi.service.component.ComponentContext;
+import org.semanticweb.owlapi.model.IRI;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Default implementation of a knowledge schema.
+ * 
+ * @author alexdma
+ * 
+ */
+@Component(metatype = true, immediate = true, configurationFactory = true, policy = ConfigurationPolicy.REQUIRE, specVersion = "1.1")
+@Service
+@Properties(value = {@Property(name = SchemaCatalog.ID), @Property(name = SchemaCatalog.LOCATION),
+                     @Property(name = SchemaCatalog.CUSTOM_SCHEMAS, cardinality = 1000)})
+public class SchemaCatalogImpl implements SchemaCatalog {
+
+    private String id;
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    private Map<IRI,Schema> schemas = new HashMap<IRI,Schema>();
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    private Configuration config;
+
+    public SchemaCatalogImpl() {
+        super();
+    }
+
+    public SchemaCatalogImpl(String id, Configuration config) {
+        this();
+        // Copy the id over to a hashtable
+        Dictionary<String,Object> componentConfig = new Hashtable<String,Object>();
+        componentConfig.put(SchemaCatalog.ID, id);
+        this.config = config;
+        try {
+            activate(componentConfig);
+        } catch (IOException e) {
+            log.error("Unable to access servlet context.", e);
+        }
+    }
+
+    /**
+     * Used to configure an instance within an OSGi container.
+     * 
+     * @throws IOException
+     */
+    @SuppressWarnings("unchecked")
+    @Activate
+    protected void activate(ComponentContext context) throws IOException {
+        log.info("in " + ExplanationGeneratorImpl.class + " activate with context " + context);
+        if (context == null) {
+            throw new IllegalStateException("No valid" + ComponentContext.class + " parsed in activate!");
+        }
+        activate((Dictionary<String,Object>) context.getProperties());
+    }
+
+    /**
+     * Called within both OSGi and non-OSGi environments.
+     * 
+     * @param configuration
+     * @throws IOException
+     */
+    protected void activate(Dictionary<String,Object> configuration) throws IOException {
+
+        id = (String) configuration.get(SchemaCatalog.ID);
+        if (id == null || id.trim().isEmpty()) id = "unnamed-" + new Date().getTime();
+
+        ONManager onm = config.getOntologyNetworkManager();
+
+        // Get the scope and populate the custom space with the registry ontologies.
+        String registry = (String) configuration.get(SchemaCatalog.LOCATION);
+        if (registry != null && !id.trim().isEmpty()) {
+            OntologyScope scope = onm.getScopeRegistry().getScope(config.getScopeID());
+
+//            // TODO: to cache or not to cache?
+//            OntologyInputSource src = new OntologyRegistryIRISource(IRI.create(registry),
+//                    onm.getOwlCacheManager(), onm.getRegistryLoader());
+//            try {
+//                scope.getCustomSpace().addOntology(src);
+//            } catch (UnmodifiableOntologySpaceException e) {
+//                log.warn("Could not add registry {} to unmodifiable space {}.", registry,
+//                    scope.getCustomSpace());
+//            }
+        }
+
+        log.debug("Schema Catalog activated.");
+
+    }
+
+    @Override
+    public void addSchema(Schema schema) {
+        schemas.put(schema.getID(), schema);
+    }
+
+    @Override
+    public void clearSchems() {
+        schemas.clear();
+    }
+
+    @Override
+    public String getId() {
+        return id;
+    }
+
+    @Override
+    public Schema getSchema(IRI schemaID) {
+        return schemas.get(schemaID);
+    }
+
+    @Override
+    public Set<Schema> getSchemas() {
+        return new HashSet<Schema>(schemas.values());
+    }
+
+    @Override
+    public boolean hasSchema(IRI schemaID) {
+        return schemas.containsKey(schemaID);
+    }
+
+    @Override
+    public void removeSchema(IRI schemaId) {
+        schemas.remove(schemaId);
+    }
+
+    @Override
+    public void removeSchema(Schema schema) {
+        Schema sc = schemas.get(schema.getID());
+        if (sc != null && sc.equals(schema)) schemas.remove(schema.getID());
+    }
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogManagerImpl.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogManagerImpl.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogManagerImpl.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.ReferencePolicy;
+import org.apache.felix.scr.annotations.ReferenceStrategy;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.explanation.api.SchemaCatalog;
+import org.apache.stanbol.explanation.api.SchemaCatalogManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Component(immediate = true)
+@Service
+public class SchemaCatalogManagerImpl implements SchemaCatalogManager {
+
+    private static final String _ODP_CATALOG_DEFAULT = "http://www.ontologydesignpatterns.org/registry/explanation.owl";
+
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, referenceInterface = SchemaCatalog.class, strategy = ReferenceStrategy.EVENT, policy = ReferencePolicy.DYNAMIC, bind = "bindSchemaCatalog", unbind = "unbindSchemaCatalog")
+    private Map<String,SchemaCatalog> catalogs = Collections.emptyMap();
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Override
+    public void addCatalog(SchemaCatalog catalog) {
+        Map<String,SchemaCatalog> tmp = new HashMap<String,SchemaCatalog>(catalogs);
+        tmp.put(catalog.getId(), catalog);
+        this.catalogs = Collections.unmodifiableMap(tmp);
+    }
+
+    /**
+     * Invoked automatically by OSGi-DS when a new {@link SchemaCatalog} is registered. For non-DS-aware
+     * environments, just use the inherited interface method {@link #addCatalog(SchemaCatalog)}.
+     * 
+     * @param catalog
+     *            the schema catalog to be bound with this manager.
+     */
+    protected void bindSchemaCatalog(SchemaCatalog catalog) {
+        if (catalog != null) {
+            log.info("Binding catalog {} to catalog manager.", catalog.getId());
+            addCatalog(catalog);
+        }
+    }
+
+    @Override
+    public Set<SchemaCatalog> getCatalogs() {
+        return new HashSet<SchemaCatalog>(catalogs.values());
+    }
+
+    @Override
+    public void removeCatalog(String id) {
+        Map<String,SchemaCatalog> tmp = new HashMap<String,SchemaCatalog>(catalogs);
+        tmp.remove(id);
+        this.catalogs = Collections.unmodifiableMap(tmp);
+    }
+
+    /**
+     * Invoked automatically by OSGi-DS when a {@link SchemaCatalog} is deregistered. For non-DS-aware
+     * environments, just use the inherited interface method {@link #removeCatalog(String)}.
+     * 
+     * @param catalog
+     *            the schema catalog to be unbound from this manager.
+     */
+    protected void unbindSchemaCatalog(SchemaCatalog catalog) {
+        if (catalog != null && catalogs.containsKey(catalog.getId())) {
+            log.info("Unbinding catalog {} from catalog manager.", catalog.getId());
+            removeCatalog(catalog.getId());
+        }
+    }
+
+}

Added: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/BinaryRelationImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/BinaryRelationImpl.java?rev=1240263&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/BinaryRelationImpl.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/BinaryRelationImpl.java Fri Feb  3 17:53:57 2012
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+package org.apache.stanbol.explanation.impl.clerezza;
+
+import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.rdf.core.Triple;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.stanbol.explanation.api.BinaryRelation;
+
+public class BinaryRelationImpl implements BinaryRelation {
+
+    private Resource object;
+
+    private String predicate;
+
+    private NonLiteral subject;
+
+    public BinaryRelationImpl(NonLiteral subject, String predicate, Resource object) {
+        this.subject = subject;
+        this.predicate = predicate;
+        this.object = object;
+    }
+
+    public BinaryRelationImpl(Triple triple) {
+        this.subject = triple.getSubject();
+        this.predicate = triple.getPredicate().getUnicodeString();
+        this.object = triple.getObject();
+    }
+
+    @Override
+    public String getFrom() {
+        if (subject instanceof UriRef) return ((UriRef) subject).getUnicodeString();
+        return subject.toString();
+    }
+
+    @Override
+    public String getProperty() {
+        return predicate;
+    }
+
+    @Override
+    public String getTo() {
+        if (object instanceof UriRef) return ((UriRef) object).getUnicodeString();
+        return object.toString();
+    }
+
+}