You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2015/07/06 11:42:42 UTC

svn commit: r1689348 - in /stanbol/branches/release-0.12/entityhub/indexing: core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/ source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/

Author: rwesten
Date: Mon Jul  6 09:42:41 2015
New Revision: 1689348

URL: http://svn.apache.org/r1689348
Log:
merged fixes for STANBOL-1433 and STANBOL-1434 from trunk to 0.12.1; needed to make minor corrections as this one uses an older Jena TDB version

Modified:
    stanbol/branches/release-0.12/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java
    stanbol/branches/release-0.12/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java

Modified: stanbol/branches/release-0.12/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java
URL: http://svn.apache.org/viewvc/stanbol/branches/release-0.12/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java?rev=1689348&r1=1689347&r2=1689348&view=diff
==============================================================================
--- stanbol/branches/release-0.12/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java (original)
+++ stanbol/branches/release-0.12/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java Mon Jul  6 09:42:41 2015
@@ -107,17 +107,18 @@ public class FieldValueFilter implements
 
     @Override
     public void setConfiguration(Map<String,Object> config) {
+        log.info("> configure {}",getClass().getSimpleName());
         IndexingConfig indexingConfig = (IndexingConfig)config.get(IndexingConfig.KEY_INDEXING_CONFIG);
         nsPrefixProvider = indexingConfig.getNamespacePrefixService();
         Object value = config.get(PARAM_FIELD);
         if(value == null || value.toString().isEmpty()){
             this.field = getUri(DEFAULT_FIELD);
-            log.info("Using default Field {}",field);
         } else {
             this.field = getUri(value.toString());
-            log.info("configured Field: {}",field);
         }
+        log.info(" - field: {}",field);
         value = config.get(PARAM_VALUES);
+        log.info(" - filters:");
         parseFilterConfig(value);
     }
 
@@ -156,6 +157,7 @@ public class FieldValueFilter implements
                     entry = "";
                 }
                 if(!includeAll && entry.equals("*")){
+                    log.info("    - includeAll");
                     includeAll = true;
                     continue;
                 }
@@ -177,8 +179,14 @@ public class FieldValueFilter implements
                 }
                 //if exclude add to this.exclude otherwise to this.values
                 (exclude ? this.exclude : this.included).add(uri);
+                log.info("    - {} {}",exclude ? "exclude" : "include", uri.isEmpty() ? "<empty>" : uri);
             }
         }
+        //if only excludes are configured add the include all
+        if(!includeAll && !exclude.isEmpty() && included.isEmpty()){
+            log.info("    - includeAll (because only exclusions are configured");
+            includeAll = true;
+        }
     }
 
     /**

Modified: stanbol/branches/release-0.12/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java
URL: http://svn.apache.org/viewvc/stanbol/branches/release-0.12/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java?rev=1689348&r1=1689347&r2=1689348&view=diff
==============================================================================
--- stanbol/branches/release-0.12/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java (original)
+++ stanbol/branches/release-0.12/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java Mon Jul  6 09:42:41 2015
@@ -780,6 +780,9 @@ public class RdfIndexingSource extends A
     @Override
     public Collection<Node> listObjects(Node subject, Node property) {
         Collection<Node> nodes = new ArrayList<Node>();
+        if(bnodePrefix != null && subject.isURI() && subject.getURI().startsWith(bnodePrefix)){
+            subject = Node.createAnon(new AnonId(subject.getURI().substring(bnodePrefix.length())));
+        }
         ExtendedIterator<Triple> it = indexingDataset.getDefaultGraph().find(subject, property, null);
         while(it.hasNext()){
             //STANBOL-765: we need also to transform bnodes to URIs for the
@@ -798,6 +801,9 @@ public class RdfIndexingSource extends A
     @Override
     public Collection<Node> listSubjects(Node property, Node object) {
         Collection<Node> nodes = new ArrayList<Node>();
+        if(bnodePrefix != null && object.isURI() && object.getURI().startsWith(bnodePrefix)){
+            object = Node.createAnon(new AnonId(object.getURI().substring(bnodePrefix.length())));
+        }
         ExtendedIterator<Triple> it = indexingDataset.getDefaultGraph().find(null, property, object);
         while(it.hasNext()){
             Node subject = it.next().getSubject();