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 2011/03/15 19:37:20 UTC

svn commit: r1081894 [4/7] - in /incubator/stanbol/trunk/kres: ./ eu.iksproject.kres.jersey/ eu.iksproject.kres.jersey/KReSConf/ eu.iksproject.kres.jersey/src/main/java/eu/iksproject/kres/jersey/ eu.iksproject.kres.jersey/src/main/java/eu/iksproject/kr...

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.db/src/test/java/eu/iksproject/kres/semion/reengineer/db/DBExtractorTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.db/src/test/java/eu/iksproject/kres/semion/reengineer/db/DBExtractorTest.java?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.db/src/test/java/eu/iksproject/kres/semion/reengineer/db/DBExtractorTest.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.db/src/test/java/eu/iksproject/kres/semion/reengineer/db/DBExtractorTest.java Tue Mar 15 18:37:12 2011
@@ -1,19 +1,15 @@
 package eu.iksproject.kres.semion.reengineer.db;
 
-import static org.junit.Assert.*;
-
 import java.util.Dictionary;
 import java.util.Hashtable;
 
 import org.apache.clerezza.rdf.core.access.TcManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.KReSONManager;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.semanticweb.owlapi.model.IRI;
-import org.semanticweb.owlapi.model.OWLOntology;
 
-import eu.iksproject.kres.api.manager.KReSONManager;
-import eu.iksproject.kres.api.semion.ReengineeringException;
 import eu.iksproject.kres.manager.ONManager;
 import eu.iksproject.kres.semion.manager.SemionManagerImpl;
 

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/pom.xml?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/pom.xml (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/pom.xml Tue Mar 15 18:37:12 2011
@@ -166,6 +166,13 @@
 			<version>2.8.3</version>
 			<scope>provided</scope>
 		</dependency>
+		
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.reengineer.base</artifactId>
+			<version>${stanbol-version}</version>
+		</dependency>	
+		<!--
 		<dependency>
 			<groupId>eu.iksproject</groupId>
 			<artifactId>eu.iksproject.kres.api</artifactId>
@@ -190,6 +197,8 @@
 			</exclusions>
 			<scope>provided</scope>
 		</dependency>
+		-->
+		
 		<dependency>
 			<groupId>eu.iksproject</groupId>
 			<artifactId>eu.iksproject.kres.ontologies</artifactId>

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XMLExtractor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XMLExtractor.java?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XMLExtractor.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XMLExtractor.java Tue Mar 15 18:37:12 2011
@@ -21,6 +21,22 @@ import org.apache.felix.scr.annotations.
 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.KReSONManager;
+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.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.KReSSession;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.KReSSessionManager;
+import org.apache.stanbol.reengineer.base.DataSource;
+import org.apache.stanbol.reengineer.base.ReengineeringException;
+import org.apache.stanbol.reengineer.base.SemionManager;
+import org.apache.stanbol.reengineer.base.SemionReengineer;
+import org.apache.stanbol.reengineer.base.util.ReengineerType;
+import org.apache.stanbol.reengineer.base.util.SemionUriRefGenerator;
+import org.apache.stanbol.reengineer.base.util.UnsupportedReengineerException;
 import org.osgi.service.component.ComponentContext;
 import org.semanticweb.owlapi.apibinding.OWLManager;
 import org.semanticweb.owlapi.model.AddAxiom;
@@ -48,22 +64,6 @@ import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-import eu.iksproject.kres.api.manager.DuplicateIDException;
-import eu.iksproject.kres.api.manager.KReSONManager;
-import eu.iksproject.kres.manager.io.RootOntologyIRISource;
-import eu.iksproject.kres.api.manager.ontology.OntologyScope;
-import eu.iksproject.kres.api.manager.ontology.OntologyScopeFactory;
-import eu.iksproject.kres.api.manager.ontology.OntologySpaceFactory;
-import eu.iksproject.kres.api.manager.ontology.ScopeRegistry;
-import eu.iksproject.kres.api.manager.session.KReSSession;
-import eu.iksproject.kres.api.manager.session.KReSSessionManager;
-import eu.iksproject.kres.api.semion.DataSource;
-import eu.iksproject.kres.api.semion.ReengineeringException;
-import eu.iksproject.kres.api.semion.SemionManager;
-import eu.iksproject.kres.api.semion.SemionReengineer;
-import eu.iksproject.kres.api.semion.util.ReengineerType;
-import eu.iksproject.kres.api.semion.util.SemionUriRefGenerator;
-import eu.iksproject.kres.api.semion.util.UnsupportedReengineerException;
 import eu.iksproject.kres.ontologies.Semion_OWL;
 import eu.iksproject.kres.ontologies.XML_OWL;
 import eu.iksproject.kres.ontologies.XSD_OWL;

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/main/java/eu/iksproject/kres/semion/reengineer/xml/XSDExtractor.java Tue Mar 15 18:37:12 2011
@@ -3,25 +3,16 @@ package eu.iksproject.kres.semion.reengi
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Enumeration;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
-import org.apache.xerces.dom.PSVIDocumentImpl;
-import org.w3c.dom.traversal.DocumentTraversal;
-import org.w3c.dom.traversal.NodeFilter;
-import org.w3c.dom.traversal.NodeIterator;
-import org.w3c.dom.traversal.TreeWalker;
-
-import org.apache.clerezza.rdf.core.LiteralFactory;
-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.TripleImpl;
-import org.apache.felix.scr.annotations.Reference;
+import org.apache.stanbol.ontologymanager.ontonet.api.KReSONManager;
+import org.apache.stanbol.reengineer.base.DataSource;
+import org.apache.stanbol.reengineer.base.util.SemionUriRefGenerator;
+import org.apache.xerces.dom.PSVIDocumentImpl;
 import org.apache.xerces.impl.dv.DatatypeException;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.xs.XSAnnotationImpl;
@@ -54,7 +45,6 @@ import org.semanticweb.owlapi.model.OWLD
 import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom;
 import org.semanticweb.owlapi.model.OWLOntology;
 import org.semanticweb.owlapi.model.OWLOntologyCreationException;
-import org.semanticweb.owlapi.model.OWLOntologyID;
 import org.semanticweb.owlapi.model.OWLOntologyManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -62,16 +52,12 @@ import org.w3c.dom.DOMException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
+import org.w3c.dom.traversal.DocumentTraversal;
+import org.w3c.dom.traversal.NodeFilter;
+import org.w3c.dom.traversal.NodeIterator;
+import org.w3c.dom.traversal.TreeWalker;
 import org.xml.sax.SAXException;
 
-
-import eu.iksproject.kres.api.manager.KReSONManager;
-import eu.iksproject.kres.api.semion.DataSource;
-import eu.iksproject.kres.api.semion.SemionManager;
-import eu.iksproject.kres.api.semion.SemionReengineer;
-import eu.iksproject.kres.api.semion.util.ReengineerType;
-import eu.iksproject.kres.api.semion.util.SemionUriRefGenerator;
 import eu.iksproject.kres.ontologies.XSD_OWL;
 
 public class XSDExtractor extends SemionUriRefGenerator {

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/test/java/eu/iksproject/kres/semion/reengineer/xml/XMLReengineerTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/test/java/eu/iksproject/kres/semion/reengineer/xml/XMLReengineerTest.java?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/test/java/eu/iksproject/kres/semion/reengineer/xml/XMLReengineerTest.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.reengineer.xml/src/test/java/eu/iksproject/kres/semion/reengineer/xml/XMLReengineerTest.java Tue Mar 15 18:37:12 2011
@@ -4,16 +4,16 @@ import java.io.InputStream;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
+import org.apache.stanbol.ontologymanager.ontonet.api.KReSONManager;
+import org.apache.stanbol.reengineer.base.DataSource;
+import org.apache.stanbol.reengineer.base.SemionReengineer;
+import org.apache.stanbol.reengineer.base.util.ReengineerType;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.semanticweb.owlapi.model.IRI;
 import org.semanticweb.owlapi.model.OWLOntology;
 
-import eu.iksproject.kres.api.manager.KReSONManager;
-import eu.iksproject.kres.api.semion.DataSource;
-import eu.iksproject.kres.api.semion.SemionReengineer;
-import eu.iksproject.kres.api.semion.util.ReengineerType;
 import eu.iksproject.kres.manager.ONManager;
 import eu.iksproject.kres.semion.manager.SemionManagerImpl;
 

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/pom.xml?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/pom.xml (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/pom.xml Tue Mar 15 18:37:12 2011
@@ -164,6 +164,23 @@
 			<version>2.8.3</version>
 			<scope>provided</scope>
 		</dependency>
+		
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.reengineer.base</artifactId>
+			<version>${stanbol-version}</version>
+		</dependency>		
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.rules.base</artifactId>
+			<version>${stanbol-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.rules.refactor</artifactId>
+			<version>${stanbol-version}</version>
+		</dependency>
+		<!--
 		<dependency>
 			<groupId>eu.iksproject</groupId>
 			<artifactId>eu.iksproject.kres.api</artifactId>
@@ -183,6 +200,7 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
+		-->
 		<dependency>
 			<groupId>eu.iksproject</groupId>
 			<artifactId>eu.iksproject.kres.ontologies</artifactId>

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/main/java/eu/iksproject/kres/semion/refactorer/SemionRefactorerImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/main/java/eu/iksproject/kres/semion/refactorer/SemionRefactorerImpl.java?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/main/java/eu/iksproject/kres/semion/refactorer/SemionRefactorerImpl.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/main/java/eu/iksproject/kres/semion/refactorer/SemionRefactorerImpl.java Tue Mar 15 18:37:12 2011
@@ -18,6 +18,27 @@ import org.apache.felix.scr.annotations.
 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.KReSONManager;
+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.KReSSession;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.KReSSessionManager;
+import org.apache.stanbol.ontologymanager.store.api.OntologyStorage;
+import org.apache.stanbol.reasoners.base.api.InconcistencyException;
+import org.apache.stanbol.reasoners.base.api.KReSReasoner;
+import org.apache.stanbol.reengineer.base.SemionManager;
+import org.apache.stanbol.rules.base.api.KReSRule;
+import org.apache.stanbol.rules.base.api.NoSuchRecipeException;
+import org.apache.stanbol.rules.base.api.Recipe;
+import org.apache.stanbol.rules.base.api.RuleStore;
+import org.apache.stanbol.rules.base.api.util.KReSRuleList;
+import org.apache.stanbol.rules.refactor.api.SemionRefactorer;
+import org.apache.stanbol.rules.refactor.api.SemionRefactoringException;
+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;
@@ -41,27 +62,6 @@ import com.hp.hpl.jena.sparql.function.F
 import com.hp.hpl.jena.sparql.pfunction.PropertyFunctionRegistry;
 import com.hp.hpl.jena.update.UpdateAction;
 
-import eu.iksproject.kres.api.manager.DuplicateIDException;
-import eu.iksproject.kres.api.manager.KReSONManager;
-import eu.iksproject.kres.api.manager.ontology.OntologyScope;
-import eu.iksproject.kres.api.manager.ontology.OntologyScopeFactory;
-import eu.iksproject.kres.api.manager.ontology.OntologySpaceFactory;
-import eu.iksproject.kres.api.manager.ontology.ScopeRegistry;
-import eu.iksproject.kres.api.manager.session.DuplicateSessionIDException;
-import eu.iksproject.kres.api.manager.session.KReSSession;
-import eu.iksproject.kres.api.manager.session.KReSSessionManager;
-import eu.iksproject.kres.api.reasoners.InconcistencyException;
-import eu.iksproject.kres.api.reasoners.KReSReasoner;
-import eu.iksproject.kres.api.rules.KReSRule;
-import eu.iksproject.kres.api.rules.NoSuchRecipeException;
-import eu.iksproject.kres.api.rules.Recipe;
-import eu.iksproject.kres.api.rules.RuleStore;
-import eu.iksproject.kres.api.rules.util.KReSRuleList;
-import eu.iksproject.kres.api.semion.SemionManager;
-import eu.iksproject.kres.api.semion.SemionRefactorer;
-import eu.iksproject.kres.api.semion.SemionRefactoringException;
-import eu.iksproject.kres.api.semion.util.URIGenerator;
-import eu.iksproject.kres.api.storage.OntologyStorage;
 import eu.iksproject.kres.rules.arqextention.CreatePropertyURIStringFromLabel;
 import eu.iksproject.kres.rules.arqextention.CreateStandardLabel;
 import eu.iksproject.kres.rules.arqextention.CreateURI;

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/ClerezzaStorage.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/ClerezzaStorage.java?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/ClerezzaStorage.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/ClerezzaStorage.java Tue Mar 15 18:37:12 2011
@@ -1,30 +1,20 @@
 package eu.iksproject.kres.semion.refactorer;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
 import java.util.HashSet;
 import java.util.Set;
 
 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.TcProviderMultiplexer;
-import org.apache.clerezza.rdf.core.access.WeightedTcProvider;
 import org.apache.clerezza.rdf.core.impl.SimpleGraph;
 import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.sparql.ParseException;
 import org.apache.clerezza.rdf.core.sparql.QueryParser;
 import org.apache.clerezza.rdf.core.sparql.query.Query;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Property;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.Service;
-import org.osgi.service.component.ComponentContext;
-import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.apache.stanbol.ontologymanager.store.api.NoSuchStoreException;
+import org.apache.stanbol.ontologymanager.store.api.OntologyStorage;
 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 com.hp.hpl.jena.ontology.OntModel;
 import com.hp.hpl.jena.ontology.OntModelSpec;
@@ -32,13 +22,9 @@ import com.hp.hpl.jena.rdf.model.Model;
 import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.util.FileManager;
 
-import eu.iksproject.kres.api.storage.NoSuchStoreException;
-import eu.iksproject.kres.api.storage.OntologyStorage;
-import eu.iksproject.kres.api.storage.OntologyStoreProvider;
 import eu.iksproject.kres.ontologies.XML_OWL;
 import eu.iksproject.kres.shared.transformation.JenaToClerezzaConverter;
 import eu.iksproject.kres.shared.transformation.JenaToOwlConvert;
-import eu.iksproject.kres.shared.transformation.OWLAPIToClerezzaConverter;
 
 public class ClerezzaStorage implements OntologyStorage {
 

Modified: incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/SemionRefactoringTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/SemionRefactoringTest.java?rev=1081894&r1=1081893&r2=1081894&view=diff
==============================================================================
--- incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/SemionRefactoringTest.java (original)
+++ incubator/stanbol/trunk/kres/eu.iksproject.kres.semion.refactorer/src/test/java/eu/iksproject/kres/semion/refactorer/SemionRefactoringTest.java Tue Mar 15 18:37:12 2011
@@ -13,6 +13,15 @@ import org.apache.clerezza.rdf.core.seri
 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.KReSONManager;
+import org.apache.stanbol.rules.base.api.KReSRule;
+import org.apache.stanbol.rules.base.api.NoSuchRecipeException;
+import org.apache.stanbol.rules.base.api.Recipe;
+import org.apache.stanbol.rules.base.api.RuleStore;
+import org.apache.stanbol.rules.base.api.util.KReSRuleList;
+import org.apache.stanbol.rules.base.api.util.RecipeList;
+import org.apache.stanbol.rules.refactor.api.SemionRefactorer;
+import org.apache.stanbol.rules.refactor.api.SemionRefactoringException;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.semanticweb.owlapi.apibinding.OWLManager;
@@ -26,15 +35,6 @@ import org.semanticweb.owlapi.model.OWLO
 import org.semanticweb.owlapi.model.OWLOntologyCreationException;
 import org.semanticweb.owlapi.model.OWLOntologyStorageException;
 
-import eu.iksproject.kres.api.manager.KReSONManager;
-import eu.iksproject.kres.api.rules.KReSRule;
-import eu.iksproject.kres.api.rules.NoSuchRecipeException;
-import eu.iksproject.kres.api.rules.Recipe;
-import eu.iksproject.kres.api.rules.RuleStore;
-import eu.iksproject.kres.api.rules.util.KReSRuleList;
-import eu.iksproject.kres.api.semion.SemionRefactorer;
-import eu.iksproject.kres.api.semion.SemionRefactoringException;
-import eu.iksproject.kres.api.semion.util.RecipeList;
 import eu.iksproject.kres.manager.ONManager;
 import eu.iksproject.kres.reasoners.KReSReasonerImpl;
 import eu.iksproject.kres.rules.manager.RecipeImpl;

Propchange: incubator/stanbol/trunk/kres/ontologymanager/ontonet/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Mar 15 18:37:12 2011
@@ -0,0 +1 @@
+.project

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/pom.xml?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/pom.xml (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/pom.xml Tue Mar 15 18:37:12 2011
@@ -0,0 +1,197 @@
+<?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>eu.iksproject</groupId>
+		<artifactId>eu.iksproject.kres.parent</artifactId>
+		<version>0.7</version>
+		<relativePath>../../eu.iksproject.kres.parent</relativePath>
+	</parent>
+
+	<groupId>org.apache.stanbol</groupId>
+	<artifactId>org.apache.stanbol.ontologymanager.ontonet</artifactId>
+	<packaging>bundle</packaging>
+	<version>${stanbol-version}</version>
+
+	<name>Apache Stanbol Ontology Network Manager</name>
+	<description>
+		A controlled environment for managing ontologies and ontology
+	    networks and user sessions managing them.
+	</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.ontologymanager.ontonet.*;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>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.scr.annotations</artifactId>
+			<version>1.2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<!-- <version>1.5.6</version>-->
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.ibm.icu</groupId>
+			<artifactId>icu4j</artifactId>
+			<version>3.4.4</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.hp.hpl.jena</groupId>
+			<artifactId>iri</artifactId>
+			<version>0.8</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.hp.hpl.jena</groupId>
+			<artifactId>jena</artifactId>
+			<version>2.6.2</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+			<version>1.2.13</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.hp.hpl.jena</groupId>
+			<artifactId>tdb</artifactId>
+			<version>0.8.5</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.hp.hpl.jena</groupId>
+			<artifactId>arq</artifactId>
+			<version>2.8.3</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.4</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>xerces</groupId>
+			<artifactId>xercesImpl</artifactId>
+			<version>2.7.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.lucene</groupId>
+			<artifactId>lucene-core</artifactId>
+			<version>3.0.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>owlapi</groupId>
+			<artifactId>owlapi</artifactId>
+			<version>3.0.0</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>org.apache.clerezza.rdf.core</artifactId>
+			<version>0.12-incubating-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>eu.iksproject</groupId>
+			<artifactId>eu.iksproject.kres.shared.dependency.owlapi</artifactId>
+			<version>${kres-version}</version>
+			<type>bundle</type>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>eu.iksproject</groupId>
+			<artifactId>eu.iksproject.kres.ontologies</artifactId>
+			<type>bundle</type>
+			<version>${kres-version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.ontologymanager.store</artifactId>
+			<type>bundle</type>
+			<version>${stanbol-version}</version>
+		</dependency>
+		
+	</dependencies>
+
+	<repositories>
+		<repository>
+			<id>com.hp.hpl.jena</id>
+			<name>jena maven repository</name>
+			<releases>
+				<updatePolicy>interval:60</updatePolicy>
+				<checksumPolicy>warn</checksumPolicy>
+			</releases>
+			<url>http://openjena.org/repo</url>
+			<layout>default</layout>
+		</repository>
+		<!-- needed for jersey -->
+		<repository>
+			<id>maven2-repository.dev.java.net</id>
+			<name>Java.net Repository for Maven</name>
+			<url>http://download.java.net/maven/2/</url>
+		</repository>
+	</repositories>
+
+</project>

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/DuplicateIDException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/DuplicateIDException.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/DuplicateIDException.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/DuplicateIDException.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,71 @@
+package org.apache.stanbol.ontologymanager.ontonet.api;
+
+import org.semanticweb.owlapi.model.IRI;
+
+/**
+ * Indicates an attempt to illegally create a resource by assigning it an IRI
+ * that already identifies another known resource. This exception typically
+ * results in the new resource not being created at all.<br>
+ * <br>
+ * This exception can be subclassed for managing specific resource type-based
+ * behaviour (e.g. scopes, spaces or sessions).
+ * 
+ * @author alessandro
+ * 
+ */
+public class DuplicateIDException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 802959772682427494L;
+
+	protected IRI dupe;
+
+	/**
+	 * Returns the IRI that identifies the existing resource. This can be use to
+	 * obtain the resource itself by passing it onto appropriate managers.
+	 * 
+	 * @return the duplicate identifier
+	 */
+	public IRI getDulicateID() {
+		return dupe;
+	}
+
+	/**
+	 * Creates a new instance of DuplicateIDException.
+	 * 
+	 * @param dupe
+	 *            the duplicate ID.
+	 */
+	public DuplicateIDException(IRI dupe) {
+		this.dupe = dupe;
+	}
+
+	/**
+	 * Creates a new instance of DuplicateIDException.
+	 * 
+	 * @param dupe
+	 *            the duplicate ID.
+	 * @param message
+	 *            the detail message.
+	 */
+	public DuplicateIDException(IRI dupe, String message) {
+		super(message);
+		this.dupe = dupe;
+	}
+
+	/**
+	 * Creates a new instance of DuplicateIDException.
+	 * 
+	 * @param dupe
+	 *            the duplicate ID.
+	 * @param cause
+	 *            the throwable that caused this exception to be thrown.
+	 */
+	public DuplicateIDException(IRI dupe, Throwable cause) {
+		this(dupe);
+		initCause(cause);
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/KReSONManager.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/KReSONManager.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/KReSONManager.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/KReSONManager.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,107 @@
+package org.apache.stanbol.ontologymanager.ontonet.api;
+
+import org.apache.stanbol.ontologymanager.ontonet.api.ontology.OntologyIndex;
+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.registry.KReSRegistryLoader;
+import org.apache.stanbol.ontologymanager.ontonet.api.session.KReSSessionManager;
+import org.apache.stanbol.ontologymanager.store.api.OntologyStorage;
+import org.semanticweb.owlapi.model.OWLDataFactory;
+import org.semanticweb.owlapi.model.OWLOntologyAlreadyExistsException;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+
+
+/**
+ * A KReS Ontology Network Manager.
+ * 
+ * @author andrea.nuzzolese
+ * 
+ */
+public interface KReSONManager {
+
+	/**
+	 * Returns the default object that automatically indexes ontologies as they
+	 * are loaded within scopes.
+	 * 
+	 * @return the default ontology index.
+	 */
+	public OntologyIndex getOntologyIndex();
+
+	/**
+	 * Returns the ontology scope factory that was created along with the
+	 * manager context.
+	 * 
+	 * @return the default ontology scope factory
+	 */
+	public OntologyScopeFactory getOntologyScopeFactory();
+
+	/**
+	 * Returns the ontology space factory that was created along with the
+	 * manager context.
+	 * 
+	 * @return the default ontology space factory.
+	 */
+	public OntologySpaceFactory getOntologySpaceFactory();
+
+	/**
+	 * Returns the default ontology storage system for this KReS instance.
+	 * 
+	 * @return the default ontology store.
+	 */
+	public OntologyStorage getOntologyStore();
+
+	/**
+	 * Returns an OWL Ontology Manager that is never cleared of its ontologies,
+	 * so it can be used for caching ontologies without having to reload them
+	 * using other managers. It is sufficient to catch
+	 * {@link OWLOntologyAlreadyExistsException}s and obtain the ontology with
+	 * that same ID from this manager.
+	 * 
+	 * @return the OWL Ontology Manager used for caching ontologies.
+	 */
+	public OWLOntologyManager getOwlCacheManager();
+
+	/**
+	 * Returns a factory object that can be used for obtaining OWL API objects.
+	 * 
+	 * @return the default OWL data factory
+	 */
+	public OWLDataFactory getOwlFactory();
+
+	/**
+	 * Returns the default ontology registry loader.
+	 * 
+	 * @return the default ontology registry loader.
+	 */
+	public KReSRegistryLoader getRegistryLoader();
+
+	/**
+	 * Returns the unique ontology scope registry for this context.
+	 * 
+	 * @return the ontology scope registry.
+	 */
+	public ScopeRegistry getScopeRegistry();
+
+	/**
+	 * Returns the unique KReS session manager for this context.
+	 * 
+	 * @return the KreS session manager.
+	 */
+	public KReSSessionManager getSessionManager();
+
+	/**
+	 * Returns the list of IRIs that identify scopes that should be activated on
+	 * startup, <i>if they exist</i>.
+	 * 
+	 * @return the list of scope IDs to activate.
+	 */
+	public String[] getUrisToActivate();
+	
+	/**
+	 * Returns the String that represent the namespace used by KReS for its ontologies
+	 * 
+	 * @return the namespace of KReS.
+	 */
+	public String getKReSNamespace();
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OWLDuplicateSafeLoader.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OWLDuplicateSafeLoader.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OWLDuplicateSafeLoader.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/OWLDuplicateSafeLoader.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,132 @@
+package org.apache.stanbol.ontologymanager.ontonet.api;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.MissingImportEvent;
+import org.semanticweb.owlapi.model.MissingImportListener;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.semanticweb.owlapi.model.OWLOntologyDocumentAlreadyExistsException;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+
+/**
+ * <p>
+ * This class is intended to manage the OWLOntologyAlreadyExistsException when it is thrown
+ * by the OWLOntologyManager as a missing import event.</p>
+ * 
+ * <p>The OWLOntologyAlreadyExistsException sometimes 
+ * occurs while loading ontologies from the owl:import statement. In some
+ * cases, duplicate import statements in the ontology network will fail when you want to
+ * do not tolerate missing imports. </p>
+ * 
+ * <p>See this scenario: if you set silent missing
+ * import handling to true in the OWLOntologyManager, then the manager will
+ * tolerate this unsuccesful tries, but you will not be sure that you have all
+ * the ontologies you need. If you set silent missing import handling to false,
+ * then the loading of the network will fail if there are duplicate owl:import
+ * statements in different places.</p>
+ * 
+ * @author enrico daga
+ * 
+ */
+public class OWLDuplicateSafeLoader {
+	/**
+	 * <p>
+	 * This is the central method that execute the loading.
+	 * The OWLOntologyManager method internally used is loadOntology().
+	 * The original state of the manager (silent missing import handling) is restored
+	 * after the operation.
+	 * If the operation fails, an exception is thrown.
+	 * Elsewhere, the OWLOntology instance is returned.
+	 * </p>
+	 * 
+	 * @param manager - an OWLOntologyManager
+	 * @param location - a string uri to load from  
+	 * @return ontology - the OWLOntology object
+	 */
+	public synchronized OWLOntology load(OWLOntologyManager manager,
+			String location) throws OWLOntologyCreationException {
+		/**
+		 * We save the state of the passed manager
+		 */
+		boolean stateImportsHandling = manager.isSilentMissingImportsHandling();
+
+		/**
+		 * We set the silent missing imports handling to true. (We want to
+		 * manage this without considering duplicated import statements)
+		 */
+		manager.setSilentMissingImportsHandling(true);
+		
+		/**
+		 * we first create a set to save any missing uri as string
+		 */
+		final Set<String> missing = new HashSet<String>();
+		/**
+		 * We setup our missing import listener
+		 */
+		MissingImportListener missingImportListener = new MissingImportListener() {
+			@Override
+			public void importMissing(MissingImportEvent arg0) {
+				if (arg0.getCreationException() instanceof OWLOntologyDocumentAlreadyExistsException) {
+					// Simply do not consider already existent ontologies as
+					// missing imports
+				} else
+					missing.add(arg0.getImportedOntologyURI().toString());
+			}
+		};
+		/**
+		 * Then we add the import listener, which will remember all the missed
+		 * uris
+		 */
+		manager.addMissingImportListener(missingImportListener);
+		
+		OWLOntology owlontology=null;
+		
+		/**
+		 * We do the actual loading. Now, if some exception occurs we return it,
+		 * since the missing import is the one we are interested to control.
+		 */
+		try {
+			owlontology=manager.loadOntology(IRI.create(location));
+		} catch (OWLOntologyCreationException e) {
+			throw e;
+		}
+		
+		/**
+		 * Now we re-set the original state of the manager
+		 */
+		manager.setSilentMissingImportsHandling(stateImportsHandling);
+		manager.removeMissingImportListener(missingImportListener);
+		
+		/**
+		 * Now - this is the key part - we remove from the list of not available
+		 * ontologies the document uris which have been alredy loaded (of course
+		 * after this method clients can overwrite such ontology document
+		 * location)
+		 */
+		for (OWLOntology o : manager.getOntologies()) {
+			String miss = manager.getOntologyDocumentIRI(o).toString();
+			missing.remove(miss);
+		}
+		/**
+		 * Are there any missing imports?
+		 */
+		int missingImports = missing.size();
+		
+		/**
+		 * If yes, throw an exception!
+		 */
+		if (missingImports != 0) {
+			String[] missuris = new String[missing.size()];
+			missuris = missing.toArray(missuris);
+			throw new OWLOntologyCreationException(
+					"There are missing imports: " + Arrays.toString(missuris));
+		}
+		/**
+		 * If no, just return the filled ontology manager.
+		 */
+		return owlontology;
+	}
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/AbstractOntologyInputSource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/AbstractOntologyInputSource.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/AbstractOntologyInputSource.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/AbstractOntologyInputSource.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,77 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.io;
+
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+
+/**
+ * Abstract implementation of {@link OntologyInputSource} with the basic methods
+ * for obtaining root ontologies and their physical IRIs where applicable.
+ * 
+ * @author alessandro
+ * 
+ */
+public abstract class AbstractOntologyInputSource implements
+		OntologyInputSource {
+
+	protected IRI physicalIri = null;
+
+	protected OWLOntology rootOntology = null;
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (!(obj instanceof OntologyInputSource))
+			return false;
+		OntologyInputSource src = (OntologyInputSource) obj;
+		return this.physicalIri.equals(src.getPhysicalIRI())
+				&& this.rootOntology.equals(src.getRootOntology());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see eu.iksproject.kres.api.manager.ontology.OntologyInputSource#getPhysicalIRI()
+	 */
+	@Override
+	public IRI getPhysicalIRI() {
+		return physicalIri;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see eu.iksproject.kres.api.manager.ontology.OntologyInputSource#getRootOntology()
+	 */
+	@Override
+	public OWLOntology getRootOntology() {
+		return rootOntology;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see eu.iksproject.kres.api.manager.ontology.OntologyInputSource#hasPhysicalIRI()
+	 */
+	@Override
+	public boolean hasPhysicalIRI() {
+		return physicalIri != null;
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see eu.iksproject.kres.api.manager.ontology.OntologyInputSource#hasRootOntology()
+	 */
+	@Override
+	public boolean hasRootOntology() {
+		return rootOntology != null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public abstract String toString();
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/BlankOntologySource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/BlankOntologySource.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/BlankOntologySource.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/BlankOntologySource.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,29 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.io;
+
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+
+/**
+ * A utility input source that contains an unnamed, empty ontology.
+ * 
+ * @author alessandro
+ *
+ */
+public class BlankOntologySource extends AbstractOntologyInputSource {
+
+	public BlankOntologySource() {
+		OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
+		try {
+			this.rootOntology = manager.createOntology();
+		} catch (OWLOntologyCreationException e) {
+			this.rootOntology = null;
+		}
+	}
+
+	@Override
+	public String toString() {
+		return "";
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/OntologyInputSource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/OntologyInputSource.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/OntologyInputSource.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/OntologyInputSource.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,63 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.io;
+
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+/**
+ * An ontology input source provides a point for loading an ontology. Currently
+ * it provides two ways of obtaining an ontology document:
+ * 
+ * <ol>
+ * <li>From an OWLOntology.
+ * <li>By dereferencing an physical IRI.
+ * </ol>
+ * 
+ * Consumers that use an ontology input source will attempt to obtain a concrete
+ * representation of an ontology in the above order. Implementations of this
+ * interface may try to dereference the IRI internally and just provide the
+ * OWLOntology, or directly provide the physical IRI for other classes to
+ * dereference. Implementations should allow multiple attempts at loading an
+ * ontology.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface OntologyInputSource {
+
+	/**
+	 * Returns the IRI by dereferencing which it should be possible to obtain
+	 * the ontology. This method is supposed to return null if the ontology
+	 * lives in-memory and was not or is not going to be stored publicly.
+	 * 
+	 * @return the physical location for this ontology source, or null if
+	 *         unknown.
+	 */
+	public IRI getPhysicalIRI();
+
+	/**
+	 * Returns the OWL Ontology that imports the whole ontology network
+	 * addressed by this input source.
+	 * 
+	 * @return the ontology network root.
+	 */
+	public OWLOntology getRootOntology();
+
+	/**
+	 * Determines if a physical IRI is known for this ontology source. Note that
+	 * an anonymous ontology may have been fetched from a physical location,
+	 * just as a named ontology may have been stored in memory and have no
+	 * physical location.
+	 * 
+	 * @return true if a physical location is known for this ontology source.
+	 */
+	public boolean hasPhysicalIRI();
+
+	/**
+	 * Determines if a root ontology that imports the entire network is
+	 * available.
+	 * 
+	 * @return true if a root ontology is available, false otherwise.
+	 */
+	public boolean hasRootOntology();
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologyIRISource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologyIRISource.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologyIRISource.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologyIRISource.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,42 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.io;
+
+import org.semanticweb.owlapi.apibinding.OWLManager;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntologyCreationException;
+import org.semanticweb.owlapi.model.OWLOntologyManager;
+
+/**
+ * An input source that provides the OWL Ontology loaded from the supplied
+ * physical IRI, as well as the physical IRI itself for consumers that need to
+ * load the ontology themselves.<br>
+ * <br>
+ * For convenience, an existing OWL ontology manager can be supplied for loading
+ * the ontology.
+ * 
+ * @author alessandro
+ * 
+ */
+public class RootOntologyIRISource extends AbstractOntologyInputSource {
+
+	public RootOntologyIRISource(IRI rootPhysicalIri)
+			throws OWLOntologyCreationException {
+		this(rootPhysicalIri, OWLManager.createOWLOntologyManager());
+	}
+
+	public RootOntologyIRISource(IRI rootPhysicalIri, OWLOntologyManager manager)
+			throws OWLOntologyCreationException {
+		physicalIri = rootPhysicalIri;
+		rootOntology = manager
+				.loadOntologyFromOntologyDocument(rootPhysicalIri);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see eu.iksproject.kres.manager.io.AbstractOntologyInputSource#toString()
+	 */
+	@Override
+	public String toString() {
+		return "ROOT_ONT_IRI<" + getPhysicalIRI() + ">";
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologySource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologySource.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologySource.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/RootOntologySource.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,41 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.io;
+
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+/**
+ * An input source that provides the supplied OWL ontology straight away. The
+ * physical IRI is either obtained from the default document IRI in the
+ * ontology, or supplied manually using the appropriate constructor (e.g.
+ * retrieved from the ontology manager that actually loaded the ontology).
+ * 
+ * @author alessandro
+ * 
+ */
+public class RootOntologySource extends AbstractOntologyInputSource {
+
+	public RootOntologySource(OWLOntology rootOntology) {
+		this.rootOntology = rootOntology;
+		try {
+			physicalIri = rootOntology.getOntologyID().getDefaultDocumentIRI();
+		} catch (Exception e) {
+			// Ontology might be anonymous, no physical IRI then...
+		}
+
+	}
+
+	public RootOntologySource(OWLOntology rootOntology, IRI phyicalIRI) {
+		this.rootOntology = rootOntology;
+		this.physicalIri = phyicalIRI;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see eu.iksproject.kres.manager.io.AbstractOntologyInputSource#toString()
+	 */
+	@Override
+	public String toString() {
+		return "ROOT_ONT<" + rootOntology.getOntologyID() + ">";
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/ScopeOntologySource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/ScopeOntologySource.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/ScopeOntologySource.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/io/ScopeOntologySource.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,31 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.io;
+
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An ontology source that rewrites the physical IRI by appending the logical
+ * one to the scope ID. If the ontology is anonymous, the original physical IRI
+ * is retained.
+ * 
+ * @author alessandro
+ * 
+ */
+public class ScopeOntologySource extends AbstractOntologyInputSource {
+
+	public ScopeOntologySource(IRI scopeIri, OWLOntology ontology, IRI origin) {
+		rootOntology = ontology;
+		LoggerFactory.getLogger(ScopeOntologySource.class).debug(
+				"[KReS] :: REWRITING " + origin + " TO " + scopeIri + "/"
+						+ ontology.getOntologyID().getOntologyIRI());
+		physicalIri = !ontology.isAnonymous() ? IRI.create(scopeIri + "/"
+				+ ontology.getOntologyID().getOntologyIRI()) : origin;
+	}
+
+	@Override
+	public String toString() {
+		return "SCOPE_ONT_IRI<" + getPhysicalIRI() + ">";
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CoreOntologySpace.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CoreOntologySpace.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CoreOntologySpace.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CoreOntologySpace.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,13 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+/**
+ * A core space represents a minimal set of readonly, immutable ontologies for
+ * modeling a given scope. For example, it may define metamodels or essential
+ * concepts and rules in a domain.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface CoreOntologySpace extends OntologySpace {
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CustomOntologySpace.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CustomOntologySpace.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CustomOntologySpace.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/CustomOntologySpace.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,39 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+/**
+ * An ontology space that wraps the components that can be customized by CMS
+ * developers, IKS customizers and the like. The custom ontology space becomes
+ * read-only after bootstrapping (i.e. after a call to <code>setUp()</code>).
+ * 
+ * The ontologies in a custom space typically depend on those in the core space.
+ * However, a custom space does <i>not</i> know which is the core space, it only
+ * imports its ontologies. The core-custom-session relationship between spaces
+ * is a scope is handled by external objects.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface CustomOntologySpace extends OntologySpace {
+
+	/**
+	 * Logically links this custom space with the supplied core ontology space,
+	 * so that the top ontology in the former will import those in the latter.<br>
+	 * <br>
+	 * This relationship is expected to hold at all times once the space is
+	 * active, however the method to set it is available in case implementations
+	 * require to perform other operations between the creation of ontology
+	 * spaces and their linking.
+	 * 
+	 * @param coreSpace
+	 *            the core ontology space to be linked
+	 * @param skipRoot
+	 *            if true, the custom root ontology will not import the core
+	 *            root ontology straight away, but instead all of its axioms and
+	 *            import statements will be copied. Useful for implementations
+	 *            that construct root ontologies in memory but do not store
+	 *            them.
+	 */
+	public void attachCoreSpace(CoreOntologySpace coreSpace, boolean skipRoot)
+			throws UnmodifiableOntologySpaceException;
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/IrremovableOntologyException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/IrremovableOntologyException.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/IrremovableOntologyException.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/IrremovableOntologyException.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,45 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import org.semanticweb.owlapi.model.IRI;
+
+/**
+ * Thrown whenever an illegal attempt at removing an ontology from an ontology
+ * space is detected. This can happen e.g. if the ontology is the space root or
+ * not a direct child thereof.
+ * 
+ * @author alessandro
+ * 
+ */
+public class IrremovableOntologyException extends
+		OntologySpaceModificationException {
+
+	protected IRI ontologyId;
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -3301398666369788964L;
+
+	/**
+	 * Constructs a new instance of <code>IrremovableOntologyException</code>.
+	 * 
+	 * @param space
+	 *            the space that holds the ontology.
+	 * @param ontologyId
+	 *            the logical IRI of the ontology whose removal was denied.
+	 */
+	public IrremovableOntologyException(OntologySpace space, IRI ontologyId) {
+		super(space);
+		this.ontologyId = ontologyId;
+	}
+
+	/**
+	 * Returns the unique identifier of the ontology whose removal was denied.
+	 * 
+	 * @return the ID of the ontology that was not removed.
+	 */
+	public IRI getOntologyId() {
+		return ontologyId;
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/MissingOntologyException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/MissingOntologyException.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/MissingOntologyException.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/MissingOntologyException.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,36 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import org.semanticweb.owlapi.model.IRI;
+
+/**
+ * Thrown whenever an attempt to modify an ontology within an ontology space
+ * that does not contain it is detected.
+ * 
+ * @author alessandro
+ * 
+ */
+public class MissingOntologyException extends
+		OntologySpaceModificationException {
+
+	public MissingOntologyException(OntologySpace space, IRI ontologyId) {
+		super(space);
+		this.ontologyId = ontologyId;
+	}
+
+	/**
+	 * Returns the unique identifier of the ontology whose removal was denied.
+	 * 
+	 * @return the ID of the ontology that was not removed.
+	 */
+	public IRI getOntologyId() {
+		return ontologyId;
+	}
+
+	protected IRI ontologyId;
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -3449667155191079302L;
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/NoSuchScopeException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/NoSuchScopeException.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/NoSuchScopeException.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/NoSuchScopeException.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,29 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import org.semanticweb.owlapi.model.IRI;
+
+/**
+ * Thrown whenever an operation on a scope that has not been registered is
+ * thrown.
+ * 
+ * @author alessandro
+ * 
+ */
+public class NoSuchScopeException extends RuntimeException {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 6339531579406287445L;
+
+	private IRI scopeID = null;
+
+	public NoSuchScopeException(IRI scopeID) {
+		this.scopeID = scopeID;
+	}
+
+	public IRI getScopeId() {
+		return scopeID;
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyIndex.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyIndex.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyIndex.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyIndex.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,61 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import java.util.Set;
+
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+/**
+ * Provides an interface to the ontologies provided by registered scopes in the
+ * ontology manager.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface OntologyIndex extends ScopeOntologyListener,
+		ScopeEventListener {
+
+	/**
+	 * Returns an ontology having the specified IRI as its identifier, or null
+	 * if no such ontology is indexed.<br>
+	 * <br>
+	 * Which ontology is returned in case more ontologies with this IRI are
+	 * registered in different scopes is at the discretion of implementors.
+	 * 
+	 * @param ontologyIri
+	 * @return
+	 */
+	public OWLOntology getOntology(IRI ontologyIri);
+
+	/**
+	 * Returns the ontology loaded within an ontology scope having the specified
+	 * IRI as its identifier, or null if no such ontology is loaded in that
+	 * scope.
+	 * 
+	 * @param ontologyIri
+	 * @return
+	 */
+	public OWLOntology getOntology(IRI ontologyIri, IRI scopeId);
+
+	/**
+	 * Returns the set of ontology scopes where an ontology with the specified
+	 * IRI is registered in either their core spaces or their custom spaces.
+	 * Optionally, session spaces can be queried as well.
+	 * 
+	 * @param ontologyIri
+	 * @param includingSessionSpaces
+	 * @return
+	 */
+	public Set<IRI> getReferencingScopes(IRI ontologyIri,
+			boolean includingSessionSpaces);
+
+	/**
+	 * Determines if an ontology with the specified identifier is loaded within
+	 * some registered ontology scope.
+	 * 
+	 * @param ontologyIri
+	 * @return
+	 */
+	public boolean isOntologyLoaded(IRI ontologyIri);
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScope.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScope.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScope.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScope.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,126 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import java.util.Set;
+
+import org.semanticweb.owlapi.model.IRI;
+
+/**
+ * Represents an ontology network that is used by KReS for modelling a given
+ * knowledge component or domain, e.g. workflows, organisations, devices,
+ * content or business domain.<br>
+ * <br>
+ * Each ontology scope comprises in turn a number of ontology spaces of three
+ * kinds.
+ * <ul>
+ * <li>Exactly one core space, which defines the immutable components of the
+ * scope.
+ * <li>At most one custom space, which contains user-defined components.
+ * <li>Zero or more session spaces, which contains (potentially volatile)
+ * components specific for user sessions.
+ * </ul>
+ * An ontology scope can thus be seen as a fa&ccedil;ade for ontology spaces.
+ * 
+ * 
+ * @author alessandro
+ * 
+ */
+public interface OntologyScope extends ScopeOntologyListenable {
+
+	/**
+	 * Adds a new ontology space to the list of user session spaces for this
+	 * scope.
+	 * 
+	 * @param sessionSpace
+	 *            the ontology space to be added.
+	 */
+	public void addSessionSpace(OntologySpace sessionSpace, IRI sessionID);
+
+	/**
+	 * Returns the core ontology space for this ontology scope. The core space
+	 * should never be null for any scope.
+	 * 
+	 * @return the core ontology space
+	 */
+	public OntologySpace getCoreSpace();
+
+	/**
+	 * Returns the custom ontology space for this ontology scope.
+	 * 
+	 * @return the custom ontology space, or null if no custom space is
+	 *         registered for this scope.
+	 */
+	public OntologySpace getCustomSpace();
+
+	/**
+	 * Returns an object that uniquely identifies this ontology scope.
+	 * 
+	 * TODO : check if we'd rather use another class for identifiers.
+	 * 
+	 * @return the unique identifier for this ontology scope
+	 */
+	public IRI getID();
+
+	/**
+	 * Return the ontology space for this scope that is identified by the
+	 * supplied IRI.
+	 * 
+	 * @param sessionID
+	 *            the unique identifier of the KReS session.
+	 * @return the ontology space identified by <code>sessionID</code>, or null
+	 *         if no such space is registered for this scope and session.
+	 */
+	public SessionOntologySpace getSessionSpace(IRI sessionID);
+
+	/**
+	 * Returns all the active ontology spaces for this scope.
+	 * 
+	 * @return a set of active ontology spaces for this scope.
+	 */
+	public Set<OntologySpace> getSessionSpaces();
+
+	/**
+	 * Sets an ontology space as the custom space for this scope.
+	 * 
+	 * @param customSpace
+	 *            the custom ontology space.
+	 * @throws UnmodifiableOntologySpaceException
+	 *             if either the scope or the supplied space are locked.
+	 */
+	public void setCustomSpace(OntologySpace customSpace)
+			throws UnmodifiableOntologySpaceException;
+
+	/**
+	 * Performs the operations required for activating the ontology scope. It
+	 * should be possible to perform them <i>after</i> the constructor has been
+	 * invoked.<br>
+	 * <br>
+	 * When the core ontology space is created for this scope, this should be
+	 * set in the scope constructor. It can be changed in the
+	 * <code>setUp()</code> method though.
+	 */
+	public void setUp();
+
+	/**
+	 * Performs whatever operations are required for making sure the custom
+	 * space of this scope is aware of changes occurring in its core space, that
+	 * all session spaces are aware of changes in the custom space, and so on.
+	 * Typically, this includes updating all import statements in the top
+	 * ontologies for each space.<br>
+	 * <br>
+	 * This method is not intended for usage by ontology managers. Since its
+	 * invocation is supposed to be automatic, it should be invoked by whatever
+	 * classes are responsible for listening to changes in an ontology
+	 * scope/space. In the default implementation, it is the scope itself, yet
+	 * the method is left public in order to allow for external controllers.
+	 */
+	public void synchronizeSpaces();
+
+	/**
+	 * Performs the operations required for deactivating the ontology scope. In
+	 * general, this is not equivalent to finalizing the object for garbage
+	 * collection. It should be possible to activate the same ontology scope
+	 * again if need be.
+	 */
+	public void tearDown();
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScopeFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScopeFactory.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScopeFactory.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologyScopeFactory.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,61 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import org.apache.stanbol.ontologymanager.ontonet.api.DuplicateIDException;
+import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
+import org.semanticweb.owlapi.model.IRI;
+
+
+/**
+ * An ontology scope factory is responsible for the creation of new ontology
+ * scopes from supplied ontology input sources for their core and custom spaces.<br>
+ * <br>
+ * Factory implementations should not call the setup method of the ontology
+ * scope once it is created, so that its spaces are not locked from editing
+ * since creation time.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface OntologyScopeFactory extends ScopeEventListenable {
+
+	/**
+	 * Creates and returns a new ontology scope with the core space ontologies
+	 * obtained from <code>coreSource</code> and the custom space not set.
+	 * 
+	 * @param scopeID
+	 *            the desired unique identifier for the ontology scope.
+	 * @param coreSource
+	 *            the input source that provides the top ontology for the core
+	 *            space.
+	 * @return the newly created ontology scope.
+	 * @throws DuplicateIDException
+	 *             if an ontology scope with the given identifier is already
+	 *             <i>registered</i>. The exception is not thrown if another
+	 *             scope with the same ID has been created but not registered.
+	 */
+	public OntologyScope createOntologyScope(IRI scopeID,
+			OntologyInputSource coreSource) throws DuplicateIDException;
+
+	/**
+	 * Creates and returns a new ontology scope with the core space ontologies
+	 * obtained from <code>coreSource</code> and the custom ontologies obtained
+	 * from <code>customSource</code>.
+	 * 
+	 * @param scopeID
+	 *            the desired unique identifier for the ontology scope.
+	 * @param coreSource
+	 *            the input source that provides the top ontology for the core
+	 *            space.
+	 * @param customSource
+	 *            the input source that provides the top ontology for the custom
+	 *            space. If null, no custom space should be created at all.
+	 * @return the newly created ontology scope.
+	 * @throws DuplicateIDException
+	 *             if an ontology scope with the given identifier is already
+	 *             <i>registered</i>. The exception is not thrown if another
+	 *             scope with the same ID has been created but not registered.
+	 */
+	public OntologyScope createOntologyScope(IRI scopeID,
+			OntologyInputSource coreSource, OntologyInputSource customSource)
+			throws DuplicateIDException;
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpace.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,174 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
+import org.semanticweb.owlapi.model.IRI;
+import org.semanticweb.owlapi.model.OWLOntology;
+
+
+/**
+ * An ontology space identifies the set of OWL ontologies that should be
+ * "active" in a given context, e.g. for a certain user session or a specific
+ * reasoning service. Each ontology space has an ID and a top ontology that can
+ * be used as a shared resource for mutual exclusion and locking strategies.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface OntologySpace {
+
+	/**
+	 * Adds the given ontology to the ontology space.
+	 * 
+	 * @param ontology
+	 *            the ontology to be added
+	 * @throws UnmodifiableOntologySpaceException
+	 *             if the ontology space is read-only
+	 */
+	public void addOntology(OntologyInputSource ontologySource)
+			throws UnmodifiableOntologySpaceException;
+
+	public void addOntologySpaceListener(OntologySpaceListener listener);
+
+	public void clearOntologySpaceListeners();
+
+	/**
+	 * Returns a Unique Resource Identifier (URI) that identifies this ontology
+	 * space. For instance, this URI could be the parent of (some/most of) the
+	 * base URIs for the ontologies within this space.
+	 * 
+	 * @return the URI that identifies this ontology space
+	 */
+	public IRI getID();
+
+	/**
+	 * Returns all the ontologies encompassed by this ontology space.
+	 * 
+	 * @return the set of ontologies in the ontology space
+	 */
+	public Set<OWLOntology> getOntologies();
+
+	/**
+	 * Returns the ontology identified by the supplied <i>logical</i> IRI, if
+	 * such an ontology has been loaded in this space.<br>
+	 * <br>
+	 * Note that ontologies are not identified by physical IRI here. There's no
+	 * need to ask KReS for ontologies by physical IRI, use a browser or some
+	 * other program instead!
+	 * 
+	 * @param ontologyIri
+	 *            the <i>logical</i> identifier of the ontology to query for.
+	 * 
+	 * @return the requested ontology, or null if no ontology with this ID has
+	 *         been loaded.
+	 */
+	public OWLOntology getOntology(IRI ontologyIri);
+	
+	public boolean containsOntology(IRI ontologyIri);
+
+	public Collection<OntologySpaceListener> getOntologyScopeListeners();
+
+	/**
+	 * Returns the ontology that serves as a root module for this ontology
+	 * space.
+	 * 
+	 * @return the root module of the ontology space
+	 */
+	public OWLOntology getTopOntology();
+
+	/**
+	 * Determines if the ontology identified by the supplied <i>logical</i> IRI
+	 * has been loaded in this space.<br>
+	 * <br>
+	 * Note that ontologies are not identified by physical IRI here. There's no
+	 * need to ask KReS for ontologies by physical IRI, use a browser or some
+	 * other program instead!
+	 * 
+	 * @param ontologyIri
+	 *            the <i>logical</i> identifier of the ontology to query for.
+	 * 
+	 * @return true if an ontology with this ID has been loaded in this space.
+	 */
+	public boolean hasOntology(IRI ontologyIri);
+
+	/**
+	 * Determines if it is no longer possible to modify this space until it is
+	 * torn down.
+	 * 
+	 * @return true if this space is write-locked, false otherwise.
+	 */
+	public boolean isLocked();
+
+	public boolean isSilentMissingOntologyHandling();
+
+	/**
+	 * Removes the given ontology from the ontology space, if the ontology is a
+	 * direct child of the top ontology. This means that the ontology must
+	 * neither be the top ontology for this space, nor a subtree of an imported
+	 * ontology. This is a conservative measure to avoid using undefined
+	 * entities in the space.
+	 * 
+	 * @param ontology
+	 *            the ontology to be removed
+	 * @throws UnmodifiableOntologySpaceException
+	 *             if the ontology space is read-only
+	 */
+	public void removeOntology(OntologyInputSource src)
+			throws OntologySpaceModificationException;
+
+	public void removeOntologySpaceListener(OntologySpaceListener listener);
+	
+	public void setSilentMissingOntologyHandling(boolean silent);
+	
+	/**
+	 * Sets the supplied ontology as the root ontology that (recursively)
+	 * references the whole underlying ontology network. This actually
+	 * <i>replaces</i> the ontology to be obtained by a call to
+	 * <code>getTopOntology()</code> with this one, i.e. it is <code>not</code>
+	 * equivalent to adding this ontology to a blank network!<br>
+	 * <br>
+	 * Implementations can arbitrarily behave with respect to the unset
+	 * <code>createParent</code> parameter from the other method signature.
+	 * 
+	 * @param ontology
+	 *            the new top ontology.
+	 * @throws OntologySpaceModificationException
+	 *             if the ontology space is read-only or the ontology could not
+	 *             be removed.
+	 */
+	public void setTopOntology(OntologyInputSource ontologySource)
+			throws UnmodifiableOntologySpaceException;
+
+	/**
+	 * Sets the supplied ontology as the root ontology that (recursively)
+	 * references the whole underlying ontology network. This actually
+	 * <i>replaces</i> the ontology to be obtained by a call to
+	 * <code>getTopOntology()</code> with this one, i.e. it is <code>not</code>
+	 * equivalent to adding this ontology to a blank network!
+	 * 
+	 * @param ontology
+	 *            the new top ontology.
+	 * @param createParent
+	 *            if true, a new ontology will be created and set as the top
+	 *            ontology that will import this one.
+	 * @throws UnmodifiableOntologySpaceException
+	 *             if the ontology space is read-only.
+	 */
+	public void setTopOntology(OntologyInputSource ontologySource,
+			boolean createParent) throws UnmodifiableOntologySpaceException;
+
+	/**
+	 * Bootstraps the ontology space. In some cases (such as with core and
+	 * custom spaces) this also implies write-locking its ontologies.
+	 */
+	public void setUp();
+
+	/**
+	 * Performs all required operations for disposing of an ontology space and
+	 * releasing its resources (e.g. removing the writelock).
+	 */
+	public void tearDown();
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceEvent.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceEvent.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceEvent.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceEvent.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,11 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+/**
+ * Placeholder for a wrapper of events that affect ontology spaces.
+ * 
+ * @author alessandro
+ * 
+ */
+public class OntologySpaceEvent {
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceFactory.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,58 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import org.apache.stanbol.ontologymanager.ontonet.api.io.OntologyInputSource;
+import org.semanticweb.owlapi.model.IRI;
+
+
+/**
+ * An ontology space factory is responsible for the creation of new, readily
+ * specialized ontology spaces from supplied ontology input sources.
+ * 
+ * Implementations should not call the setup method of the ontology space once
+ * it is created, so that it is not locked from editing since creation time.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface OntologySpaceFactory {
+
+	/**
+	 * Creates and sets up a default core ontology space.
+	 * 
+	 * @param scopeID
+	 *            the unique identifier of the ontology scope that will
+	 *            reference this space. It can be used for generating the
+	 *            identifier for this ontology space.
+	 * @param coreSource
+	 *            the input source for the ontologies in this space.
+	 * @return the generated ontology space.
+	 */
+	public CoreOntologySpace createCoreOntologySpace(IRI scopeID,
+			OntologyInputSource coreSource);
+
+	/**
+	 * Creates and sets up a default custom ontology space.
+	 * 
+	 * @param scopeID
+	 *            the unique identifier of the ontology scope that will
+	 *            reference this space. It can be used for generating the
+	 *            identifier for this ontology space.
+	 * @param customSource
+	 *            the input source for the ontologies in this space.
+	 * @return the generated ontology space.
+	 */
+	public CustomOntologySpace createCustomOntologySpace(IRI scopeID,
+			OntologyInputSource customSource);
+
+	/**
+	 * Creates and sets up a default session ontology space.
+	 * 
+	 * @param scopeID
+	 *            the unique identifier of the ontology scope that will
+	 *            reference this space. It can be used for generating the
+	 *            identifier for this ontology space.
+	 * @return the generated ontology space.
+	 */
+	public SessionOntologySpace createSessionOntologySpace(IRI scopeID);
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceListener.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceListener.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceListener.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceListener.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,11 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import org.semanticweb.owlapi.model.IRI;
+
+public interface OntologySpaceListener {
+
+	public void onOntologyAdded(IRI spaceId, IRI addedOntology);
+
+	public void onOntologyRemoved(IRI spaceId, IRI removedOntology);
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceModificationException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceModificationException.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceModificationException.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/OntologySpaceModificationException.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,39 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+/**
+ * Thrown whenever an illegal operation that modifies an ontology space is
+ * detected and denied.
+ * 
+ * @author alessandro
+ * 
+ */
+public class OntologySpaceModificationException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -5147080356192253724L;
+
+	protected OntologySpace space;
+
+	/**
+	 * Creates a new instance of OntologySpaceModificationException.
+	 * 
+	 * @param space
+	 *            the ontology space whose modification was attempted.
+	 */
+	public OntologySpaceModificationException(OntologySpace space) {
+		this.space = space;
+	}
+
+	/**
+	 * Returns the ontology space that threw the exception (presumably after a
+	 * failed modification attempt).
+	 * 
+	 * @return the ontology space on which the exception was thrown.
+	 */
+	public OntologySpace getSpace() {
+		return space;
+	}
+
+}

Added: incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/ScopeEventListenable.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/ScopeEventListenable.java?rev=1081894&view=auto
==============================================================================
--- incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/ScopeEventListenable.java (added)
+++ incubator/stanbol/trunk/kres/ontologymanager/ontonet/src/main/java/org/apache/stanbol/ontologymanager/ontonet/api/ontology/ScopeEventListenable.java Tue Mar 15 18:37:12 2011
@@ -0,0 +1,22 @@
+package org.apache.stanbol.ontologymanager.ontonet.api.ontology;
+
+import java.util.Collection;
+
+/**
+ * Implementations of this interface are able to fire events related to the
+ * modification of an ontology scope, not necessarily including its ontologies.
+ * 
+ * @author alessandro
+ * 
+ */
+public interface ScopeEventListenable {
+
+	public void addScopeEventListener(ScopeEventListener listener);
+
+	public void clearScopeEventListeners();
+
+	public Collection<ScopeEventListener> getScopeEventListeners();
+
+	public void removeScopeEventListener(ScopeEventListener listener);
+
+}