incubator-stanbol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alex...@apache.org
Subject svn commit: r1296354 - in /incubator/stanbol/branches/ontonet-showcase: contentorganizer/ contentorganizer/src/main/java/org/apache/stanbol/contentorganizer/impl/ explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ explanation/core/src/...
Date Fri, 02 Mar 2012 17:51:54 GMT
Author: alexdma
Date: Fri Mar  2 17:51:53 2012
New Revision: 1296354

URL: http://svn.apache.org/viewvc?rev=1296354&view=rev
Log:
- Started refactoring Java packages for ontonet in preparation of STANBOL-467
- Early interface for OntologyCollector->Graph reconciliation (STANBOL-426)

Modified:
    incubator/stanbol/branches/ontonet-showcase/contentorganizer/pom.xml
    incubator/stanbol/branches/ontonet-showcase/contentorganizer/src/main/java/org/apache/stanbol/contentorganizer/impl/ContentHubOrganizer.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/SchemaCatalogImpl.java
    incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/ClerezzaSchemaMatcherImpl.java

Modified: incubator/stanbol/branches/ontonet-showcase/contentorganizer/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/contentorganizer/pom.xml?rev=1296354&r1=1296353&r2=1296354&view=diff
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/contentorganizer/pom.xml (original)
+++ incubator/stanbol/branches/ontonet-showcase/contentorganizer/pom.xml Fri Mar  2 17:51:53
2012
@@ -57,6 +57,10 @@
 		<!-- Stanbol deps -->
 		<dependency>
 			<groupId>org.apache.stanbol</groupId>
+			<artifactId>org.apache.stanbol.commons.owl</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.stanbol</groupId>
 			<artifactId>org.apache.stanbol.commons.stanboltools.datafileprovider</artifactId>
 		</dependency>
 		<dependency>
@@ -73,17 +77,15 @@
 		</dependency>
 		<dependency>
 			<groupId>org.apache.stanbol</groupId>
-			<artifactId>org.apache.stanbol.owl</artifactId>
+			<artifactId>org.apache.stanbol.reasoners.manager</artifactId>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.stanbol</groupId>
-			<artifactId>org.apache.stanbol.reasoners.hermit</artifactId>
-			<version>0.9.0-incubating-SNAPSHOT</version>
+			<artifactId>org.apache.stanbol.reasoners.owlapi</artifactId>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.stanbol</groupId>
-			<artifactId>org.apache.stanbol.reasoners.manager</artifactId>
-			<version>0.9.0-incubating-SNAPSHOT</version>
+			<artifactId>org.apache.stanbol.rules.base</artifactId>
 		</dependency>
 
 		<!-- Testing deps -->
@@ -106,7 +108,7 @@
 						<Data-Files>ontologies</Data-Files>
 						<Data-Files-Priority>-100</Data-Files-Priority>
 						<Export-Package>
-							org.apache.stanbol.entitytranslator.*
+							org.apache.stanbol.contentorganizer.*
 						</Export-Package>
 						<Import-Package>
 							org.slf4j.*,

Modified: incubator/stanbol/branches/ontonet-showcase/contentorganizer/src/main/java/org/apache/stanbol/contentorganizer/impl/ContentHubOrganizer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/contentorganizer/src/main/java/org/apache/stanbol/contentorganizer/impl/ContentHubOrganizer.java?rev=1296354&r1=1296353&r2=1296354&view=diff
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/contentorganizer/src/main/java/org/apache/stanbol/contentorganizer/impl/ContentHubOrganizer.java
(original)
+++ incubator/stanbol/branches/ontonet-showcase/contentorganizer/src/main/java/org/apache/stanbol/contentorganizer/impl/ContentHubOrganizer.java
Fri Mar  2 17:51:53 2012
@@ -20,9 +20,11 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Dictionary;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -36,6 +38,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.commons.owl.transformation.OWLAPIToClerezzaConverter;
 import org.apache.stanbol.contenthub.servicesapi.search.solr.SolrSearch;
 import org.apache.stanbol.contenthub.servicesapi.store.Store;
 import org.apache.stanbol.contentorganizer.model.Category;
@@ -46,14 +49,24 @@ import org.apache.stanbol.contentorganiz
 import org.apache.stanbol.enhancer.servicesapi.ContentItem;
 import org.apache.stanbol.entityhub.servicesapi.Entityhub;
 import org.apache.stanbol.entityhub.servicesapi.site.ReferencedSiteManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.collector.DuplicateIDException;
+import org.apache.stanbol.ontologymanager.ontonet.api.scope.OntologyScope;
+import org.apache.stanbol.reasoners.owlapi.OWLApiReasoningService;
+import org.apache.stanbol.rules.base.api.RuleStore;
 import org.osgi.service.component.ComponentContext;
+import org.semanticweb.owlapi.model.OWLAxiom;
+import org.semanticweb.owlapi.model.OWLOntology;
+import org.semanticweb.owlapi.util.InferredAxiomGenerator;
+import org.semanticweb.owlapi.util.InferredClassAssertionAxiomGenerator;
+import org.semanticweb.owlapi.util.InferredPropertyAssertionGenerator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * 
  * @author alexdma
- *
+ * 
  */
 @Component(immediate = true, metatype = false)
 @Service
@@ -66,6 +79,12 @@ public class ContentHubOrganizer impleme
 
     @Reference
     protected Store contentStore;
+    
+    @Reference
+    protected RuleStore ruleStore;
+
+    @Reference
+    protected ONManager onManager;
 
     @Reference
     protected SolrSearch solrSearch;
@@ -77,6 +96,9 @@ public class ContentHubOrganizer impleme
     protected Serializer serializer;
 
     @Reference
+    private OWLApiReasoningService reasoner;
+
+    @Reference
     protected ReferencedSiteManager siteMgr;
 
     private ContentConnector connector;
@@ -139,6 +161,16 @@ public class ContentHubOrganizer impleme
      */
     protected void activate(Dictionary<String,Object> configuration) throws IOException
{
 
+        // Setup OntoNet
+        String scopeId = "DBPedia";
+        OntologyScope scope = null;
+        try {
+            scope = onManager.getOntologyScopeFactory().createOntologyScope(scopeId);
+        } catch (DuplicateIDException e) {
+            log.warn("Scope {} already exist, will use that. ", scopeId);
+            scope = onManager.getScopeRegistry().getScope(scopeId);
+        }
+
         connector = new ContentHubConnector(contentStore, solrSearch);
         classifyContent(contentStore);
 
@@ -179,6 +211,7 @@ public class ContentHubOrganizer impleme
 
         File f = null;
         try {
+            // All the content metadata in one file.
             f = new File(contentMetadataDir, "all.rdf");
             serializer.serialize(new FileOutputStream(f), mg, SupportedFormat.RDF_XML);
         } catch (UnsupportedFormatException e) {
@@ -189,6 +222,7 @@ public class ContentHubOrganizer impleme
         }
 
         try {
+            // All the enhancements in another file
             f = new File(contentMetadataDir, "enhancement.rdf");
             serializer.serialize(new FileOutputStream(f), contentStore.getEnhancementGraph(),
                 SupportedFormat.RDF_XML);
@@ -199,6 +233,15 @@ public class ContentHubOrganizer impleme
             log.error("Could not obtain file {} for writing. ", f);
         }
 
+//        ruleStore.createRecipe(recipeID, rulesInKReSSyntax)
+        List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<?
extends OWLAxiom>>();
+        gens.add(new InferredClassAssertionAxiomGenerator());
+        gens.add(new InferredPropertyAssertionGenerator());
+        OWLOntology o = OWLAPIToClerezzaConverter.clerezzaGraphToOWLOntology(contentStore
+                .getEnhancementGraph());
+
+//        reasoner.run(o, gens);
+
         return null;
     }
 

Modified: 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=1296354&r1=1296353&r2=1296354&view=diff
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationGeneratorImpl.java
(original)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/ExplanationGeneratorImpl.java
Fri Mar  2 17:51:53 2012
@@ -47,15 +47,15 @@ import org.apache.stanbol.explanation.ap
 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.collector.DuplicateIDException;
+import org.apache.stanbol.ontologymanager.ontonet.api.collector.UnmodifiableOntologyCollectorException;
 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.scope.OntologyScope;
+import org.apache.stanbol.ontologymanager.ontonet.api.scope.OntologySpace;
 import org.apache.stanbol.ontologymanager.ontonet.api.session.Session;
 import org.apache.stanbol.ontologymanager.ontonet.api.session.SessionManager;
 import org.osgi.service.component.ComponentContext;

Modified: 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=1296354&r1=1296353&r2=1296354&view=diff
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogImpl.java
(original)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/SchemaCatalogImpl.java
Fri Mar  2 17:51:53 2012
@@ -37,7 +37,7 @@ import org.apache.stanbol.explanation.ap
 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.apache.stanbol.ontologymanager.ontonet.api.scope.OntologyScope;
 import org.osgi.service.component.ComponentContext;
 import org.semanticweb.owlapi.model.IRI;
 import org.slf4j.Logger;

Modified: incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/ClerezzaSchemaMatcherImpl.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/ClerezzaSchemaMatcherImpl.java?rev=1296354&r1=1296353&r2=1296354&view=diff
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/ClerezzaSchemaMatcherImpl.java
(original)
+++ incubator/stanbol/branches/ontonet-showcase/explanation/core/src/main/java/org/apache/stanbol/explanation/impl/clerezza/ClerezzaSchemaMatcherImpl.java
Fri Mar  2 17:51:53 2012
@@ -35,14 +35,14 @@ import org.apache.stanbol.explanation.ap
 import org.apache.stanbol.explanation.api.Schema;
 import org.apache.stanbol.explanation.api.SchemaMatcher;
 import org.apache.stanbol.explanation.impl.ClerezzaSchemaMatcher;
-import org.apache.stanbol.ontologymanager.ontonet.api.DuplicateIDException;
 import org.apache.stanbol.ontologymanager.ontonet.api.ONManager;
+import org.apache.stanbol.ontologymanager.ontonet.api.collector.DuplicateIDException;
+import org.apache.stanbol.ontologymanager.ontonet.api.collector.UnmodifiableOntologyCollectorException;
 import org.apache.stanbol.ontologymanager.ontonet.api.io.BlankOntologySource;
 import org.apache.stanbol.ontologymanager.ontonet.api.io.GraphSource;
 import org.apache.stanbol.ontologymanager.ontonet.api.io.RootOntologySource;
-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.scope.OntologyScope;
+import org.apache.stanbol.ontologymanager.ontonet.api.scope.OntologySpace;
 import org.apache.stanbol.ontologymanager.registry.api.RegistryContentException;
 import org.apache.stanbol.ontologymanager.registry.api.model.Library;
 import org.osgi.service.component.ComponentContext;



Mime
View raw message