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 2012/12/06 11:44:01 UTC

svn commit: r1417801 [2/3] - in /stanbol/trunk: commons/ commons/solr/install/src/main/java/org/apache/stanbol/commons/solr/install/impl/ enhancement-engines/entitytagging/ enhancement-engines/entitytagging/src/main/java/org/apache/stanbol/enhancer/eng...

Modified: stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java (original)
+++ stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FieldValueFilter.java Thu Dec  6 10:43:52 2012
@@ -16,7 +16,6 @@
 */
 package org.apache.stanbol.entityhub.indexing.core.processor;
 
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -24,9 +23,10 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.indexing.core.EntityProcessor;
 import org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig;
-import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.Reference;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
 import org.slf4j.Logger;
@@ -57,6 +57,8 @@ public class FieldValueFilter implements
      * define any values for the configured {@link #field}
      */
     boolean includeEmpty;
+
+    private NamespacePrefixService nsPrefixService;
     
     @Override
     public Representation process(Representation source) {
@@ -92,12 +94,14 @@ public class FieldValueFilter implements
 
     @Override
     public void setConfiguration(Map<String,Object> config) {
+        IndexingConfig indexingConfig = (IndexingConfig)config.get(IndexingConfig.KEY_INDEXING_CONFIG);
+        nsPrefixService = indexingConfig.getNamespacePrefixService();
         Object value = config.get(PARAM_FIELD);
         if(value == null || value.toString().isEmpty()){
-            this.field = NamespaceEnum.getFullName(DEFAULT_FIELD);
+            this.field = NamespaceMappingUtils.getConfiguredUri(nsPrefixService, DEFAULT_FIELD);
             log.info("Using default Field {}",field);
         } else {
-            this.field = NamespaceEnum.getFullName(DEFAULT_FIELD);
+            this.field = NamespaceMappingUtils.getConfiguredUri(nsPrefixService, value.toString());
             log.info("configured Field: {}",field);
         }
         value = config.get(PARAM_VALUES);
@@ -113,7 +117,7 @@ public class FieldValueFilter implements
                         if(fieldValue.isEmpty() || fieldValue.equalsIgnoreCase("null")){
                             this.includeEmpty = true;
                         } else {
-                            values.add(NamespaceEnum.getFullName(fieldValue));
+                            values.add(NamespaceMappingUtils.getConfiguredUri(nsPrefixService, fieldValue));
                         }
                     } 
                 }
@@ -136,7 +140,7 @@ public class FieldValueFilter implements
                         if(filterString.isEmpty() || filterString.equalsIgnoreCase("null")){
                             this.includeEmpty = true;
                         } else {
-                            values.add(NamespaceEnum.getFullName(filterString));
+                            values.add(NamespaceMappingUtils.getConfiguredUri(nsPrefixService, filterString));
                         }
                     }
                 }

Modified: stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FiledMapperProcessor.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FiledMapperProcessor.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FiledMapperProcessor.java (original)
+++ stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/processor/FiledMapperProcessor.java Thu Dec  6 10:43:52 2012
@@ -18,24 +18,19 @@ package org.apache.stanbol.entityhub.ind
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.LineIterator;
-import org.apache.stanbol.entityhub.core.mapping.DefaultFieldMapperImpl;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.core.mapping.FieldMappingUtils;
-import org.apache.stanbol.entityhub.core.mapping.ValueConverterFactory;
 import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
-import org.apache.stanbol.entityhub.core.site.CacheUtils;
 import org.apache.stanbol.entityhub.indexing.core.EntityProcessor;
 import org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig;
 import org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapper;
-import org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapping;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
 import org.apache.stanbol.entityhub.servicesapi.model.ValueFactory;
 
@@ -45,6 +40,7 @@ public class FiledMapperProcessor implem
     public static final String DEFAULT_MAPPINGS_FILE_NAME = "fieldMappings.txt";
     private FieldMapper mapper;
     private ValueFactory vf;
+    private NamespacePrefixService nsPrefixService;
     /**
      * This Constructor relays on that {@link #setConfiguration(Map)} is called
      * afterwards!
@@ -70,7 +66,7 @@ public class FiledMapperProcessor implem
         if(mappings == null){
             throw new IllegalArgumentException("The parsed field mappings MUST NOT be NULL!");
         }
-        mapper = FieldMappingUtils.createDefaultFieldMapper(mappings);
+        mapper = FieldMappingUtils.createDefaultFieldMapper(mappings,nsPrefixService);
         if(mapper.getMappings().isEmpty()){
             throw new IllegalStateException("The parsed field mappings MUST contain at least a single valid mapping!");
         }
@@ -80,7 +76,7 @@ public class FiledMapperProcessor implem
         if(mappings == null){
             throw new IllegalArgumentException("The parsed field mappings MUST NOT be NULL!");
         }
-        this.mapper = createMapperFormStream(mappings);
+        this.mapper = createMapperFormStream(mappings,nsPrefixService);
     }
     @Override
     public Representation process(Representation source) {
@@ -122,6 +118,7 @@ public class FiledMapperProcessor implem
     @Override
     public void setConfiguration(Map<String,Object> config) {
         IndexingConfig indexingConfig = (IndexingConfig)config.get(IndexingConfig.KEY_INDEXING_CONFIG);
+        nsPrefixService = indexingConfig.getNamespacePrefixService();
         Object value = config.get(PARAM_MAPPINGS);
         if(value == null || value.toString().isEmpty()){
             //use the mappings configured for the Index
@@ -134,7 +131,7 @@ public class FiledMapperProcessor implem
             if(mappings != null){
                 try {
                     InputStream in = new FileInputStream(mappings);
-                    this.mapper = createMapperFormStream(in);
+                    this.mapper = createMapperFormStream(in,nsPrefixService);
                     IOUtils.closeQuietly(in);
                 } catch (IOException e) {
                     throw new IllegalArgumentException("Unable to access FieldMapping file "+
@@ -157,7 +154,7 @@ public class FiledMapperProcessor implem
      * @param in the stream to read the mappings from
      * @throws IOException on any error while reading the data from the stream
      */
-    private static FieldMapper createMapperFormStream(final InputStream in) throws IOException {
+    private static FieldMapper createMapperFormStream(final InputStream in, NamespacePrefixService nps) throws IOException {
         return FieldMappingUtils.createDefaultFieldMapper(new Iterator<String>() {
             LineIterator it = IOUtils.lineIterator(in, "UTF-8");
             @Override
@@ -172,7 +169,7 @@ public class FiledMapperProcessor implem
             public void remove() {
                 it.remove();
             }
-        });
+        },nps);
     }
 
 }

Modified: stanbol/trunk/entityhub/indexing/dblp/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/dblp/pom.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/dblp/pom.xml (original)
+++ stanbol/trunk/entityhub/indexing/dblp/pom.xml Thu Dec  6 10:43:52 2012
@@ -110,6 +110,19 @@
       <scope>runtime</scope>
     </dependency>
 
+    <!-- namespace prefixes mappings -->
+    <dependency> <!-- provides the default Stanbol mappings -->
+     <groupId>org.apache.stanbol</groupId>
+     <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.stanbol</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <dependency> <!-- provides the prefix.cc mappings -->
+     <groupId>org.apache.stanbol</groupId>
+     <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.prefixcc</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+
+
     <dependency> <!-- for the Main (command line utility) -->
       <groupId>commons-cli</groupId>
       <artifactId>commons-cli</artifactId>

Modified: stanbol/trunk/entityhub/indexing/dbpedia/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/dbpedia/pom.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/dbpedia/pom.xml (original)
+++ stanbol/trunk/entityhub/indexing/dbpedia/pom.xml Thu Dec  6 10:43:52 2012
@@ -118,6 +118,18 @@
       <scope>runtime</scope>
     </dependency>
 
+    <!-- namespace prefixes mappings -->
+    <dependency> <!-- provides the default Stanbol mappings -->
+     <groupId>org.apache.stanbol</groupId>
+     <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.stanbol</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <dependency> <!-- provides the prefix.cc mappings -->
+     <groupId>org.apache.stanbol</groupId>
+     <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.prefixcc</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+
     <dependency> <!-- for the Main (command line utility) -->
       <groupId>commons-cli</groupId>
       <artifactId>commons-cli</artifactId>

Modified: stanbol/trunk/entityhub/indexing/dbpedia/src/main/resources/indexing/config/mappings.txt
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/dbpedia/src/main/resources/indexing/config/mappings.txt?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/dbpedia/src/main/resources/indexing/config/mappings.txt (original)
+++ stanbol/trunk/entityhub/indexing/dbpedia/src/main/resources/indexing/config/mappings.txt Thu Dec  6 10:43:52 2012
@@ -103,7 +103,7 @@ dbp-ont:birthDate | d=xsd:dateTime
 dbp-ont:deathDate | d=xsd:dateTime
 dbp-ont:populationTotal | d=xsd:long
 dbp-ont:wikiPageExternalLink | d=xsd:anyURI
-dbpedia-owl:areaTotal | d=xsd:double
+dbp-ont:areaTotal | d=xsd:double
 
 # the "DBpedia properties are all key values pairs extracted from the info boxes
 # on the right hand side of Wikipedia pages.

Modified: stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml (original)
+++ stanbol/trunk/entityhub/indexing/destination/solryard/pom.xml Thu Dec  6 10:43:52 2012
@@ -136,6 +136,13 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <!-- namespace prefixes mappings are used in the unit tests-->
+    <dependency> <!-- provides the default Stanbol mappings -->
+     <groupId>org.apache.stanbol</groupId>
+     <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.stanbol</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>    
 
   </dependencies>
 

Modified: stanbol/trunk/entityhub/indexing/genericrdf/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/genericrdf/pom.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/genericrdf/pom.xml (original)
+++ stanbol/trunk/entityhub/indexing/genericrdf/pom.xml Thu Dec  6 10:43:52 2012
@@ -93,6 +93,19 @@
       <scope>runtime</scope>
     </dependency>
 
+    <!-- namespace prefixes mappings -->
+    <dependency> <!-- provides the default Stanbol mappings -->
+     <groupId>org.apache.stanbol</groupId>
+     <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.stanbol</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <dependency> <!-- provides the prefix.cc mappings -->
+     <groupId>org.apache.stanbol</groupId>
+     <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.prefixcc</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+
+
     <dependency> <!-- for the Main (command line utility) -->
       <groupId>commons-cli</groupId>
       <artifactId>commons-cli</artifactId>

Modified: stanbol/trunk/entityhub/indexing/source/jenatdb/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/source/jenatdb/pom.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/source/jenatdb/pom.xml (original)
+++ stanbol/trunk/entityhub/indexing/source/jenatdb/pom.xml Thu Dec  6 10:43:52 2012
@@ -96,6 +96,12 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.commons.namespaceprefix.service</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.entityhub.indexing.core</artifactId>
       <version>0.11.0-SNAPSHOT</version>
     </dependency>

Modified: stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/ResourceFilterIterator.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/ResourceFilterIterator.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/ResourceFilterIterator.java (original)
+++ stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/ResourceFilterIterator.java Thu Dec  6 10:43:52 2012
@@ -16,8 +16,6 @@
 */
 package org.apache.stanbol.entityhub.indexing.source.jenatdb;
 
-import static org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum.getFullName;
-
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
@@ -25,8 +23,11 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.indexing.core.EntityDataIterable;
 import org.apache.stanbol.entityhub.indexing.core.EntityIterator;
+import org.apache.stanbol.entityhub.indexing.core.config.IndexingConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -64,6 +65,7 @@ public class ResourceFilterIterator impl
     private Node field;
     private Collection<Node> values;
     
+    
     /**
      * The RDF data
      */
@@ -78,16 +80,26 @@ public class ResourceFilterIterator impl
      */
     private Iterator<Node> valueIterator;
 
+    /**
+     * The IndexingConfiguration
+     */
+    private IndexingConfig indexingConfig;
+
+    private NamespacePrefixService nsPrefixService;
+
     @Override
     public void setConfiguration(Map<String,Object> config) {
+        indexingConfig = (IndexingConfig)config.get(IndexingConfig.KEY_INDEXING_CONFIG);
         this.indexingDataset = Utils.getTDBDataset(config);
-        
+        nsPrefixService = indexingConfig.getNamespacePrefixService();
         Object value = config.get(PARAM_FIELD);
         if(value == null || value.toString().isEmpty()){
-            this.field = Node.createURI(getFullName(DEFAULT_FIELD));
+            this.field = Node.createURI(NamespaceMappingUtils.getConfiguredUri(
+                nsPrefixService, DEFAULT_FIELD));
             log.info("Using default Field {}",field);
         } else {
-            this.field = Node.createURI(getFullName(DEFAULT_FIELD));
+            this.field = Node.createURI(NamespaceMappingUtils.getConfiguredUri(
+                nsPrefixService, value.toString()));
             log.info("configured Field: {}",field);
         }
         value = config.get(PARAM_VALUES);
@@ -132,7 +144,8 @@ public class ResourceFilterIterator impl
                             "provide much better performance (change configuration to use" +
                             "the RdfIndexingSource as EntityDataIterable)!");
                 } else {
-                    values.add(Node.createURI(getFullName(fieldValue)));
+                    values.add(Node.createURI(NamespaceMappingUtils.getConfiguredUri(
+                        nsPrefixService, fieldValue)));
                 }
             }
         }

Modified: stanbol/trunk/entityhub/jersey/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/pom.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/pom.xml (original)
+++ stanbol/trunk/entityhub/jersey/pom.xml Thu Dec  6 10:43:52 2012
@@ -85,6 +85,11 @@
       <artifactId>org.apache.stanbol.commons.web.base</artifactId>
       <version>0.10.1-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.commons.namespaceprefix.service</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
 
     <!-- dependencies on other Entityhub modules -->
     <dependency>

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/fragment/EntityhubWebFragment.java Thu Dec  6 10:43:52 2012
@@ -24,7 +24,9 @@ import java.util.Set;
 
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.commons.web.base.LinkResource;
 import org.apache.stanbol.commons.web.base.NavigationLink;
 import org.apache.stanbol.commons.web.base.ScriptResource;
@@ -44,9 +46,6 @@ import org.apache.stanbol.entityhub.jers
 import org.osgi.framework.BundleContext;
 import org.osgi.service.component.ComponentContext;
 
-import freemarker.cache.ClassTemplateLoader;
-import freemarker.cache.TemplateLoader;
-
 @Component(immediate = true, metatype = true)
 @Service
 public class EntityhubWebFragment implements WebFragment {
@@ -55,8 +54,15 @@ public class EntityhubWebFragment implem
     
     private static final String STATIC_RESOURCE_PATH = "/org/apache/stanbol/entityhub/jersey/static";
 
-    private static final String TEMPLATE_PATH = "/org/apache/stanbol/entityhub/jersey/templates";
+//    private static final String TEMPLATE_PATH = "/org/apache/stanbol/entityhub/jersey/templates";
 
+    /**
+     * This service is used to map '{prefix}:{localname}' values to full URIs and
+     * vice versa. 
+     */
+    @Reference
+    protected NamespacePrefixService nsPrefixService;
+    
     private BundleContext bundleContext;
 
     @Activate

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileProperty.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileProperty.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileProperty.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileProperty.java Thu Dec  6 10:43:52 2012
@@ -17,7 +17,8 @@
 package org.apache.stanbol.entityhub.jersey.grefine;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,36 +76,43 @@ public class ReconcileProperty {
      * @return the {@link ReconcileProperty} or <code>null</code> if the parsed
      * String is illegal formatted.
      */
-    public static ReconcileProperty parseProperty(String propertyString){
+    public static ReconcileProperty parseProperty(String propertyString, NamespacePrefixService nxPrefixService){
         propertyString = StringUtils.trimToNull(propertyString);
         if(propertyString != null){
             propertyString = StringUtils.trimToNull(propertyString);
             if(propertyString == null){
                 log.warn("Unable to parse Reconcile Property: The parsed propertyString MUST contain some none trimable chars!");
+                return null;
+            }
+            String propertyUri = nxPrefixService.getFullName(propertyString);
+            if(propertyUri == null){
+                log.warn("The property '{}' uses the unknown prefix '{}' -> ignored",
+                    propertyString,NamespaceMappingUtils.getPrefix(propertyString));
+                return null;
             }
-            boolean special = propertyString.charAt(0) == SPECIAL_PROPERTY_PREFIX;
+            boolean special = propertyUri.charAt(0) == SPECIAL_PROPERTY_PREFIX;
             if(!special){
-                return new ReconcileProperty(special, NamespaceEnum.getFullName(propertyString), null);
+                return new ReconcileProperty(special, propertyUri, null);
             } // else parse special property name and parameter
-            if(propertyString.length() < 1){
+            if(propertyUri.length() < 1){
                 log.warn("Unable to parse Reconcile Property: The parsed propertyString MUST NOT " +
                         "contain only the special property prefix '{}'!",
                         SPECIAL_PROPERTY_PREFIX);
                 return null;
             }
-            int valueSeparatorIndex = propertyString.indexOf(SPECAIL_PROPERTY_VALUE_SEPARATOR);
+            int valueSeparatorIndex = propertyUri.indexOf(SPECAIL_PROPERTY_VALUE_SEPARATOR);
             String name = StringUtils.trimToNull(
-                propertyString.substring(1, valueSeparatorIndex > 0 ? 
-                        valueSeparatorIndex : propertyString.length()));
+                propertyUri.substring(1, valueSeparatorIndex > 0 ? 
+                        valueSeparatorIndex : propertyUri.length()));
             if(name == null) {
                 log.warn("Unable to parse Reconcile Property: The parsed special " +
-                		"property '{}' has an empty property name!",propertyString);
+                		"property '{}' has an empty property name!",propertyUri);
                 return null;
             }
             return new ReconcileProperty(special, name, 
                 //parse the parameter from the parsed value
-                valueSeparatorIndex > 0 && valueSeparatorIndex < propertyString.length() ?
-                        StringUtils.trimToNull(propertyString.substring(valueSeparatorIndex+1)):null);
+                valueSeparatorIndex > 0 && valueSeparatorIndex < propertyUri.length() ?
+                        StringUtils.trimToNull(propertyUri.substring(valueSeparatorIndex+1)):null);
         } else {
             log.warn("Unable to parse Reconcile Property from NULL or an empty String!");
             return null;

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileQuery.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileQuery.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileQuery.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileQuery.java Thu Dec  6 10:43:52 2012
@@ -29,9 +29,9 @@ import java.util.Set;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 
-import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
-import org.apache.stanbol.entityhub.servicesapi.model.ValueFactory;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
@@ -134,11 +134,11 @@ public class ReconcileQuery {
         }
     }
     
-    public Collection<ReconcileValue> putProperty(String field, Collection<ReconcileValue> values){
+    public Collection<ReconcileValue> putProperty(String field, Collection<ReconcileValue> values, NamespacePrefixService nsPrefixService){
         if(field == null || field.isEmpty()){
             throw new IllegalArgumentException("The field for an property MUST NOT be NULL!");
         }
-        ReconcileProperty property = ReconcileProperty.parseProperty(field);
+        ReconcileProperty property = ReconcileProperty.parseProperty(field, nsPrefixService);
         if(property != null){
             if(values == null || values.isEmpty()){
                 return properties.remove(values);
@@ -158,7 +158,7 @@ public class ReconcileQuery {
     public Iterable<Entry<ReconcileProperty,Collection<ReconcileValue>>> getProperties(){
         return properties.entrySet();
     }
-    public static Map<String,ReconcileQuery> parseQueries(String queriesString) throws WebApplicationException {
+    public static Map<String,ReconcileQuery> parseQueries(String queriesString,NamespacePrefixService nsPrefixService) throws WebApplicationException {
         JSONObject jQueries;
         try {
             jQueries = new JSONObject(queriesString);
@@ -173,7 +173,7 @@ public class ReconcileQuery {
         while(keys.hasNext()){
             String key = keys.next();
             try {
-                ReconcileQuery query = parseQuery(jQueries.getJSONObject(key));
+                ReconcileQuery query = parseQuery(jQueries.getJSONObject(key), nsPrefixService);
                 queries.put(key, query);
             } catch (JSONException e) {
                 throw new WebApplicationException(
@@ -192,7 +192,7 @@ public class ReconcileQuery {
      * case of the parsed string is not a well formated query. Unsupported
      * Properties are silently ignored (warnings are still logged).
      */
-    public static ReconcileQuery parseQuery(String queryString) throws WebApplicationException {
+    public static ReconcileQuery parseQuery(String queryString, NamespacePrefixService nsPrefixService) throws WebApplicationException {
         JSONObject jQuery;
         try {
             if(queryString.charAt(0) == '{') {
@@ -207,10 +207,10 @@ public class ReconcileQuery {
                 Response.status(Response.Status.BAD_REQUEST).entity(
                     "The parsed query is illegal formatted! \n query: \n"+queryString+"\n").build());
         }
-        return parseQuery(jQuery);
+        return parseQuery(jQuery, nsPrefixService);
     }
     
-    private static ReconcileQuery parseQuery(JSONObject jQuery) throws WebApplicationException {
+    private static ReconcileQuery parseQuery(JSONObject jQuery, NamespacePrefixService nsPrefixService) throws WebApplicationException {
         //query (string)
         //limit (integer), optional
         //type (string| [string]), optional
@@ -235,9 +235,11 @@ public class ReconcileQuery {
         } else if((jTypes = jQuery.optJSONArray("type")) != null){
             types = new HashSet<String>(jTypes.length());
             for(int i=0;i<jTypes.length();i++){
-                String type = NamespaceEnum.getFullName(jTypes.optString(i));
+                String type = nsPrefixService.getFullName(jTypes.optString(i));
                 if(type != null && !type.isEmpty()){
                     types.add(type);
+                } else {
+                    log.warn("Unable to parse entity type from parsed type {}",jTypes.optString(i));
                 }
             }
         } else {
@@ -266,7 +268,7 @@ public class ReconcileQuery {
         JSONArray jProperties = jQuery.optJSONArray("properties");
         if(jProperties != null){
             for(int i=0;i<jProperties.length();i++){
-                parseProperty(reconcileQuery, jProperties.optJSONObject(i));
+                parseProperty(reconcileQuery, jProperties.optJSONObject(i), nsPrefixService);
             }
         }
         return reconcileQuery;
@@ -278,7 +280,7 @@ public class ReconcileQuery {
      * @param reconcileQuery the query to add the property
      * @param jProperty the JSON formatted property
      */
-    private static void parseProperty(ReconcileQuery reconcileQuery,JSONObject jProperty) {
+    private static void parseProperty(ReconcileQuery reconcileQuery,JSONObject jProperty, NamespacePrefixService nsPrefixService) {
         if(jProperty != null){
             //parse property
             String property = jProperty.optString("pid");
@@ -300,7 +302,7 @@ public class ReconcileQuery {
                     log.warn("Ignore Property '{}' because it has no value! \n {}",property,jProperty.toString());
                 } else if(jValue instanceof JSONObject){
                     //Reconciliation data available!
-                    ReconcileValue value = parseValueFromV(jValue);
+                    ReconcileValue value = parseValueFromV(jValue, nsPrefixService);
                     if(value != null){
                         values.add(value);
                     } else {
@@ -314,7 +316,7 @@ public class ReconcileQuery {
                         jValue = jValueArray.opt(j);
                         if(jValue instanceof JSONObject){
                             //Reconciliation data available!
-                            ReconcileValue value = parseValueFromV(jValue);
+                            ReconcileValue value = parseValueFromV(jValue, nsPrefixService);
                             if(value != null){
                                 values.add(value);
                             } else {
@@ -334,7 +336,7 @@ public class ReconcileQuery {
                 }
                 
                 if(!values.isEmpty()){
-                    reconcileQuery.putProperty(property, values);
+                    reconcileQuery.putProperty(property, values, nsPrefixService);
                 }
             }
         }
@@ -346,8 +348,18 @@ public class ReconcileQuery {
      * @return The value or <code>null</code> if the parsed json object does not
      * contain the required information.
      */
-    private static ReconcileValue parseValueFromV(Object jValue) {
+    private static ReconcileValue parseValueFromV(Object jValue, NamespacePrefixService nsPrefixService) {
+        if(jValue == null){
+            return null;
+        }
         String id = ((JSONObject)jValue).optString("id");
+        if(id != null){
+            id = nsPrefixService.getFullName(id);
+            if(id == null){
+                log.warn("Unknown prefix '{}' used by 'id' of element {} -> will use NULL as id",
+                    NamespaceMappingUtils.getPrefix(id),jValue.toString());
+            }
+        }
         String value = ((JSONObject)jValue).optString("name");
         return value != null ? new ReconcileValue(id,value) : null;
     }

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileValue.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileValue.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileValue.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/grefine/ReconcileValue.java Thu Dec  6 10:43:52 2012
@@ -35,7 +35,7 @@ public class ReconcileValue {
         this(null,value);
     }
     ReconcileValue(String id, Object value){
-        this.id = id == null ? null : NamespaceEnum.getFullName(id);
+        this.id = id;
         if(value == null){
             throw new IllegalArgumentException("The parsed value MUST NOT be NULL!");
         }

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java Thu Dec  6 10:43:52 2012
@@ -27,7 +27,9 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
@@ -37,11 +39,13 @@ import javax.ws.rs.ext.MessageBodyReader
 import javax.ws.rs.ext.Provider;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
+import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.entityhub.core.mapping.ValueConverterFactory;
 import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
 import org.apache.stanbol.entityhub.core.query.FieldQueryImpl;
 import org.apache.stanbol.entityhub.ldpath.query.LDPathFieldQueryImpl;
-import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.ValueFactory;
 import org.apache.stanbol.entityhub.servicesapi.query.Constraint;
 import org.apache.stanbol.entityhub.servicesapi.query.Constraint.ConstraintType;
@@ -66,6 +70,16 @@ public class FieldQueryReader implements
     private static final ValueFactory valueFactory = InMemoryValueFactory.getInstance();
     private static final ValueConverterFactory converterFactory = ValueConverterFactory.getDefaultInstance();
     
+    private ServletContext context;
+    
+    public FieldQueryReader(@Context ServletContext context) {
+        this.context = context;
+    }
+    
+    private NamespacePrefixService getNsPrefixService(){
+        return ContextHelper.getServiceFromContext(NamespacePrefixService.class, context);
+    }
+    
     @Override
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
         log.debug("isReadable type {}, mediaType {}",type,mediaType);
@@ -86,8 +100,7 @@ public class FieldQueryReader implements
             acceptedType = MediaType.TEXT_PLAIN_TYPE;
         }
         try {
-            return fromJSON( 
-                queryString,acceptedType);
+            return fromJSON(queryString,acceptedType, getNsPrefixService());
         } catch (JSONException e) {
             log.error("Unable to parse Request ",e);
             StringBuilder message = new StringBuilder();
@@ -117,7 +130,8 @@ public class FieldQueryReader implements
      * @throws JSONException
      * @throws WebApplicationException
      */
-    public static FieldQuery fromJSON(String jsonQueryString,MediaType acceptedMediaType) throws JSONException,WebApplicationException{
+    public static FieldQuery fromJSON(String jsonQueryString,MediaType acceptedMediaType, 
+                                      NamespacePrefixService nsPrefixService) throws JSONException,WebApplicationException {
         if(jsonQueryString == null){
             throw new IllegalArgumentException("The parsed JSON object MUST NOT be NULL!");
         }
@@ -150,11 +164,8 @@ public class FieldQueryReader implements
             JSONObject jConstraint = constraints.getJSONObject(i);
             if(jConstraint.has("field")){
                 String field = jConstraint.getString("field");
-                field = NamespaceEnum.getFullName(field);
                 //check if there is already a constraint for that field
                 if(field == null || field.isEmpty()){
-//                    log.warn("The value of the key \"field\" MUST NOT be NULL nor emtpy!");
-//                    log.warn("Constraint:\n {}",jConstraint.toString(4));
                     parsingErrorMessages.append('\n');
                     parsingErrorMessages.append(
                         "Each Field Query Constraint MUST define a value for 'field'\n");
@@ -163,12 +174,23 @@ public class FieldQueryReader implements
                     parsingErrorMessages.append('\n');
                     parsingError = true;
                     continue;
-                } else if(query.isConstrained(field)){
- //                   log.warn("Multiple constraints for field {} in parsed FieldQuery!",field);
+                }
+                String fieldUri = nsPrefixService.getFullName(field);
+                if(fieldUri == null){
+                    parsingErrorMessages.append('\n');
+                    parsingErrorMessages.append(
+                        "The 'field' '").append(field).append("uses an unknown namespace prefix '");
+                    parsingErrorMessages.append(NamespaceMappingUtils.getPrefix(field)).append("'\n");
+                    parsingErrorMessages.append("Parsed Constraint:\n");
+                    parsingErrorMessages.append(jConstraint.toString(4));
+                    parsingErrorMessages.append('\n');
+                    parsingError = true;
+                    continue;
+                }else if(query.isConstrained(fieldUri)){
                     parsingErrorMessages.append('\n');
                     parsingErrorMessages.append(
                         "The parsed Query defines multiple constraints fr the field '"
-                        +field+"'!\n");
+                        +fieldUri+"'!\n");
                     parsingErrorMessages.append("FieldQuery allows only a single Constraint for a field\n");
                     parsingErrorMessages.append("Parsed Constraints:\n");
                     parsingErrorMessages.append(constraints.toString(4));
@@ -177,7 +199,7 @@ public class FieldQueryReader implements
                     continue;
                 } else {
                     try {
-                        query.setConstraint(field, parseConstraint(jConstraint));
+                        query.setConstraint(fieldUri, parseConstraint(jConstraint,nsPrefixService));
                     } catch (IllegalArgumentException e) {
                         parsingErrorMessages.append('\n');
                         parsingErrorMessages.append(e.getMessage());
@@ -209,7 +231,7 @@ public class FieldQueryReader implements
         if(selected != null){
             for(int i=0;i<selected.length();i++){
                 String selectedField = selected.getString(i);
-                selectedField = NamespaceEnum.getFullName(selectedField);
+                selectedField = nsPrefixService.getFullName(selectedField);
                 if(selectedField != null && !selectedField.isEmpty()){
                     query.addSelectedField(selectedField);
                 }
@@ -243,7 +265,7 @@ public class FieldQueryReader implements
         return query;
     }
 
-    private static Constraint parseConstraint(JSONObject jConstraint) throws JSONException {
+    private static Constraint parseConstraint(JSONObject jConstraint, NamespacePrefixService nsPrefixService) throws JSONException {
         if(jConstraint.has("type") && !jConstraint.isNull("type")) {
             String type = jConstraint.getString("type");
             //Event that internally "reference" is not part of the
@@ -252,15 +274,15 @@ public class FieldQueryReader implements
             //Value constraints with the dataType Reference and AnyURI are
             //considered to represent reference constraints
             if(type.equals("reference")){
-                return parseReferenceConstraint(jConstraint);
+                return parseReferenceConstraint(jConstraint,nsPrefixService);
             } else if (type.equals(ConstraintType.value.name())){
-                return parseValueConstraint(jConstraint);
+                return parseValueConstraint(jConstraint, nsPrefixService);
             } else if (type.equals(ConstraintType.text.name())){
                 return parseTextConstraint(jConstraint);
             } else if (type.equals(ConstraintType.range.name())){
-                return parseRangeConstraint(jConstraint);
+                return parseRangeConstraint(jConstraint,nsPrefixService);
             } else if(type.equals(ConstraintType.similarity.name())){
-                return parseSimilarityConstraint(jConstraint);
+                return parseSimilarityConstraint(jConstraint, nsPrefixService);
             } else {
                 log.warn(String.format("Unknown Constraint Type %s. Supported values are %s",               
                     Arrays.asList("reference",ConstraintType.values())));
@@ -287,7 +309,7 @@ public class FieldQueryReader implements
         }
     }
 
-    private static Constraint parseSimilarityConstraint(JSONObject jConstraint) throws JSONException {
+    private static Constraint parseSimilarityConstraint(JSONObject jConstraint, NamespacePrefixService nsPrefixService) throws JSONException {
         String context = jConstraint.optString("context");
         if(context == null){
             throw new IllegalArgumentException("SimilarityConstraints MUST define a \"context\": \n "+jConstraint.toString(4));
@@ -298,8 +320,9 @@ public class FieldQueryReader implements
             fields = new ArrayList<String>(addFields.length());
             for(int i=0;i<addFields.length();i++){
                 String field = addFields.optString(i);
+                field = field != null ? nsPrefixService.getFullName(field) : null;
                 if(field != null && !field.isEmpty()){
-                    fields.add(NamespaceEnum.getFullName(field));
+                    fields.add(field);
                 }
             }
         } else {
@@ -313,7 +336,7 @@ public class FieldQueryReader implements
      * @return
      * @throws JSONException
      */
-    private static Constraint parseRangeConstraint(JSONObject jConstraint) throws JSONException {
+    private static Constraint parseRangeConstraint(JSONObject jConstraint, NamespacePrefixService nsPrefixService) throws JSONException {
         Constraint constraint;
         boolean inclusive;
         if(jConstraint.has("inclusive")){
@@ -324,7 +347,7 @@ public class FieldQueryReader implements
         }
         Object upperBound = jConstraint.opt("upperBound");
         Object lowerBound = jConstraint.opt("lowerBound");
-        Collection<String> datatypes = parseDatatypeProperty(jConstraint);
+        Collection<String> datatypes = parseDatatypeProperty(jConstraint,nsPrefixService);
         if(datatypes != null && !datatypes.isEmpty()){
             Iterator<String> it = datatypes.iterator();
             String datatype = it.next();
@@ -494,9 +517,8 @@ public class FieldQueryReader implements
      * @return
      * @throws JSONException
      */
-    private static Constraint parseValueConstraint(JSONObject jConstraint) throws JSONException {
-        Constraint constraint;
-        Collection<String> dataTypes = parseDatatypeProperty(jConstraint);
+    private static Constraint parseValueConstraint(JSONObject jConstraint, NamespacePrefixService nsPrefixService) throws JSONException {
+        Collection<String> dataTypes = parseDatatypeProperty(jConstraint, nsPrefixService);
         final List<Object> valueList;
         if(jConstraint.has("value") && !jConstraint.isNull("value")){
             Object value = jConstraint.get("value");
@@ -577,7 +599,7 @@ public class FieldQueryReader implements
      * @return
      * @throws JSONException
      */
-    private static Collection<String> parseDatatypeProperty(JSONObject jConstraint) throws JSONException {
+    private static Collection<String> parseDatatypeProperty(JSONObject jConstraint,NamespacePrefixService nsPrefixService) throws JSONException {
         Collection<String> dataTypes;
         String dataTypeKey = null;
         if(jConstraint.has("datatype")){
@@ -592,9 +614,10 @@ public class FieldQueryReader implements
                 dataTypes = new ArrayList<String>(jDataTypes.length());
                 for(int i=0;i<jDataTypes.length();i++){
                     String dataType = jDataTypes.getString(i);
+                    //convert prefix:localName to fill URI
+                    dataType = dataType != null ? nsPrefixService.getFullName(dataType) : null;
                     if(dataType != null && !dataType.isEmpty()){
-                        //convert prefix:localName to fill URI
-                        dataTypes.add(NamespaceEnum.getFullName(dataType));
+                        dataTypes.add(dataType);
                     }
                 }
                 if(dataTypes.isEmpty()){
@@ -602,8 +625,10 @@ public class FieldQueryReader implements
                 }
             } else {
                 String dataType = jConstraint.getString(dataTypeKey);
+                //convert prefix:localName to fill URI
+                dataType = dataType != null ? nsPrefixService.getFullName(dataType) : null;
                 if(dataType != null && !dataType.isEmpty()){
-                    dataTypes = Collections.singleton(NamespaceEnum.getFullName(dataType));
+                    dataTypes = Collections.singleton(dataType);
                 } else {
                     dataTypes = null;
                 }
@@ -619,15 +644,18 @@ public class FieldQueryReader implements
      * @return
      * @throws JSONException
      */
-    private static Constraint parseReferenceConstraint(JSONObject jConstraint) throws JSONException {
-        Constraint constraint;
+    private static Constraint parseReferenceConstraint(JSONObject jConstraint, NamespacePrefixService nsPrefixService) throws JSONException {
         final List<String> refList;
         if(jConstraint.has("value") && !jConstraint.isNull("value")){
             Object value = jConstraint.get("value");
             if(value instanceof JSONArray){
                 refList = new ArrayList<String>(((JSONArray)value).length());
                 for(int i=0;i<((JSONArray)value).length();i++){
-                    refList.add(NamespaceEnum.getFullName(((JSONArray)value).getString(i)));
+                    String field = ((JSONArray)value).getString(i);
+                    field = field != null ? nsPrefixService.getFullName(field) : null;
+                    if(field != null && !field.isEmpty()){
+                        refList.add(field);
+                    }
                 }
             } else if(value instanceof JSONObject){
                 log.warn("Parsed ValueConstraint does define illegal values (values={})!",value);
@@ -639,7 +667,22 @@ public class FieldQueryReader implements
                 message.append(jConstraint.toString(4));
                 throw new IllegalArgumentException(message.toString());
             } else {
-                refList = Collections.singletonList(NamespaceEnum.getFullName(jConstraint.getString("value")));
+                String field = jConstraint.getString("value");
+                field = field != null ? nsPrefixService.getFullName(field) : null;
+                if(field != null){
+                    refList = Collections.singletonList(field);
+                } else {
+                    refList = Collections.emptyList();
+                }
+            }
+            if(refList.isEmpty()){
+                log.warn("Parsed ReferenceConstraint does not define a single valid \"value\"!");
+                StringBuilder message = new StringBuilder();
+                message.append("Parsed ReferenceConstraint does not define a single valid 'value'!\n");
+                message.append("This means values where only null, empty string or '{prefix}:{localname}' values with unknown {prefix}\n");
+                message.append("Parsed Constraint: \n");
+                message.append(jConstraint.toString(4));
+                throw new IllegalArgumentException(message.toString());                
             }
             MODE mode = parseConstraintValueMode(jConstraint);
             return new ReferenceConstraint(refList,mode);

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/RepresentationReader.java Thu Dec  6 10:43:52 2012
@@ -19,7 +19,6 @@ package org.apache.stanbol.entityhub.jer
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.Collections;
@@ -46,7 +45,6 @@ import org.apache.clerezza.rdf.core.MGra
 import org.apache.clerezza.rdf.core.NonLiteral;
 import org.apache.clerezza.rdf.core.Triple;
 import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.serializedform.Parser;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 import org.apache.clerezza.rdf.core.serializedform.UnsupportedParsingFormatException;

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java Thu Dec  6 10:43:52 2012
@@ -44,7 +44,6 @@ import static org.apache.stanbol.entityh
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -54,6 +53,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.DefaultValue;
@@ -74,12 +74,12 @@ import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.core.Response.Status;
 
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.commons.viewable.Viewable;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
-import org.apache.stanbol.commons.web.base.utils.MediaTypeUtil;
 import org.apache.stanbol.entityhub.core.query.QueryResultListImpl;
 import org.apache.stanbol.entityhub.jersey.utils.JerseyUtils;
 import org.apache.stanbol.entityhub.ldpath.EntityhubLDPath;
@@ -95,7 +95,6 @@ import org.apache.stanbol.entityhub.serv
 import org.apache.stanbol.entityhub.servicesapi.model.rdf.RdfResourceEnum;
 import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
 import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
-import org.apache.stanbol.entityhub.servicesapi.util.ModelUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -125,16 +124,12 @@ public class EntityhubRootResource exten
      * The default number of maximal results of searched sites.
      */
     private static final int DEFAULT_FIND_RESULT_LIMIT = 5;
-    /**
-     * The default result fields for /find queries is the entityhub-maodel:label and the
-     * entityhub-maodel:description.
-     */
-    private static final Collection<? extends String> DEFAULT_FIND_SELECTED_FIELDS = Arrays.asList(
-        RdfResourceEnum.label.getUri(), RdfResourceEnum.description.getUri());
+    private NamespacePrefixService nsPrefixService;
 
     // bind the job manager by looking it up from the servlet request context
-    public EntityhubRootResource() {
+    public EntityhubRootResource(@Context ServletContext servletContext) {
         super();
+        nsPrefixService = ContextHelper.getServiceFromContext(NamespacePrefixService.class, servletContext);
     }
     @OPTIONS
     public Response handleCorsPreflight(@Context HttpHeaders headers){
@@ -467,7 +462,7 @@ public class EntityhubRootResource exten
     @Path("/find")
     @Produces( {APPLICATION_JSON, RDF_XML, N3, TURTLE, X_TURTLE, RDF_JSON, N_TRIPLE, TEXT_HTML})
     public Response findEntity(@FormParam(value = "name") String name,
-                               @FormParam(value = "field") String field,
+                               @FormParam(value = "field") String parsedField,
                                @FormParam(value = "lang") String language,
                                @FormParam(value = "limit") Integer limit,
                                @FormParam(value = "offset") Integer offset,
@@ -494,12 +489,26 @@ public class EntityhubRootResource exten
                     .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
             }
         } else {
-            if (field == null || field.trim().isEmpty()) {
-                field = DEFAULT_FIND_FIELD;
+            final String property;
+            if (parsedField == null) {
+                property = DEFAULT_FIND_FIELD;
             } else {
-                field = field.trim();
+                parsedField = parsedField.trim();
+                if (parsedField.isEmpty()) {
+                    property = DEFAULT_FIND_FIELD;
+                } else {
+                    property = nsPrefixService.getFullName(parsedField);
+                    if(property == null){
+                        String messsage = String.format("The prefix '%s' of the parsed field '%' is not "
+                            + "mapped to any namespace. Please parse the full URI instead!\n",
+                            NamespaceMappingUtils.getPrefix(parsedField),parsedField);
+                        return Response.status(Status.BAD_REQUEST)
+                                .entity(messsage)
+                                .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
+                    }
+                }
             }
-            FieldQuery query = JerseyUtils.createFieldQueryForFindRequest(name, field, language,
+            FieldQuery query = JerseyUtils.createFieldQueryForFindRequest(name, property, language,
                 limit == null || limit < 1 ? DEFAULT_FIND_RESULT_LIMIT : limit, offset,ldpath);
             
             // For the Entityhub we support to select additional fields for results

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java Thu Dec  6 10:43:52 2012
@@ -17,10 +17,10 @@
 package org.apache.stanbol.entityhub.jersey.resource;
 
 import static javax.ws.rs.HttpMethod.DELETE;
-import static javax.ws.rs.HttpMethod.POST;
-import static javax.ws.rs.HttpMethod.PUT;
 import static javax.ws.rs.HttpMethod.GET;
 import static javax.ws.rs.HttpMethod.OPTIONS;
+import static javax.ws.rs.HttpMethod.POST;
+import static javax.ws.rs.HttpMethod.PUT;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
 import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
 import static javax.ws.rs.core.MediaType.TEXT_HTML;
@@ -43,16 +43,15 @@ import static org.apache.stanbol.entityh
 
 import java.io.File;
 import java.net.URI;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.Map.Entry;
 
 import javax.servlet.ServletContext;
 import javax.ws.rs.Consumes;
@@ -80,6 +79,8 @@ import javax.ws.rs.core.UriInfo;
 import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
 import org.apache.clerezza.rdf.ontologies.RDFS;
 import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.commons.viewable.Viewable;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
@@ -91,7 +92,6 @@ import org.apache.stanbol.entityhub.ldpa
 import org.apache.stanbol.entityhub.ldpath.query.LDPathSelect;
 import org.apache.stanbol.entityhub.model.clerezza.RdfRepresentation;
 import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory;
-import org.apache.stanbol.entityhub.servicesapi.EntityhubException;
 import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.Entity;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
@@ -101,11 +101,11 @@ import org.apache.stanbol.entityhub.serv
 import org.apache.stanbol.entityhub.servicesapi.site.License;
 import org.apache.stanbol.entityhub.servicesapi.site.ManagedSite;
 import org.apache.stanbol.entityhub.servicesapi.site.ManagedSiteException;
-import org.apache.stanbol.entityhub.servicesapi.site.Site;
 import org.apache.stanbol.entityhub.servicesapi.site.ReferencedSiteConfiguration;
-import org.apache.stanbol.entityhub.servicesapi.site.SiteManager;
+import org.apache.stanbol.entityhub.servicesapi.site.Site;
 import org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration;
 import org.apache.stanbol.entityhub.servicesapi.site.SiteException;
+import org.apache.stanbol.entityhub.servicesapi.site.SiteManager;
 import org.apache.stanbol.entityhub.servicesapi.util.AdaptingIterator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -113,8 +113,6 @@ import org.slf4j.LoggerFactory;
 import at.newmedialab.ldpath.exception.LDPathParseException;
 import at.newmedialab.ldpath.model.programs.Program;
 
-import com.hp.hpl.jena.reasoner.rulesys.builtins.GE;
-
 /**
  * Resource to provide a REST API for the {@link SiteManager}
  * <p/>
@@ -159,6 +157,8 @@ public class ReferencedSiteRootResource 
     private static final int DEFAULT_FIND_RESULT_LIMIT = 5;
     
     private Site site;
+
+    private NamespacePrefixService nsPrefixService;
     
     public ReferencedSiteRootResource(@PathParam(value = "site") String siteId,
                                       @Context ServletContext servletContext) {
@@ -179,6 +179,7 @@ public class ReferencedSiteRootResource 
         if(site instanceof ManagedSite){
             log.debug("   ... init ManagedSite");
         }
+        nsPrefixService = ContextHelper.getServiceFromContext(NamespacePrefixService.class, servletContext);
     }
 
     @OPTIONS
@@ -524,7 +525,7 @@ public class ReferencedSiteRootResource 
     @POST
     @Path("/find")
     public Response findEntity(@FormParam(value = "name") String name,
-                               @FormParam(value = "field") String field,
+                               @FormParam(value = "field") String parsedField,
                                @FormParam(value = "lang") String language,
                                // @FormParam(value="select") String select,
                                @FormParam(value = "limit") Integer limit,
@@ -548,16 +549,27 @@ public class ReferencedSiteRootResource 
                     .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
             }
         }
-        if (field == null) {
-            field = DEFAULT_FIND_FIELD;
+        final String property;
+        if (parsedField == null) {
+            property = DEFAULT_FIND_FIELD;
         } else {
-            field = field.trim();
-            if (field.isEmpty()) {
-                field = DEFAULT_FIND_FIELD;
+            parsedField = parsedField.trim();
+            if (parsedField.isEmpty()) {
+                property = DEFAULT_FIND_FIELD;
+            } else {
+                property = nsPrefixService.getFullName(parsedField);
+                if(property == null){
+                    String messsage = String.format("The prefix '%s' of the parsed field '%' is not "
+                        + "mapped to any namespace. Please parse the full URI instead!\n",
+                        NamespaceMappingUtils.getPrefix(parsedField),parsedField);
+                    return Response.status(Status.BAD_REQUEST)
+                            .entity(messsage)
+                            .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
+                }
             }
         }
         return executeQuery(createFieldQueryForFindRequest(
-                name, field, language,
+                name, property, language,
                 limit == null || limit < 1 ? DEFAULT_FIND_RESULT_LIMIT : limit, 
                 offset,ldpath),
             headers);
@@ -738,16 +750,16 @@ public class ReferencedSiteRootResource 
         rep.add(namespace+"localMode", site.supportsLocalMode());
         rep.add(namespace+"supportsSearch", site.supportsSearch());
         SiteConfiguration config = site.getConfiguration();
-        rep.add(NamespaceEnum.rdfs+"label", config.getName());
-        rep.add(NamespaceEnum.rdf+"type", valueFactory.createReference(namespace+"ReferencedSite"));
+        rep.add("http://www.w3.org/2000/01/rdf-schema#label", config.getName());
+        rep.add("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", valueFactory.createReference(namespace+"ReferencedSite"));
         if(config.getDescription() != null){
-            rep.add(NamespaceEnum.rdfs+"description", config.getDescription());
+            rep.add("http://www.w3.org/2000/01/rdf-schema#description", config.getDescription());
         }
         if(config.getAttribution() != null){
-            rep.add(NamespaceEnum.cc.getNamespace()+"attributionName", config.getAttribution());
+            rep.add("http://creativecommons.org/ns#attributionName", config.getAttribution());
         }
         if(config.getAttributionUrl() != null){
-            rep.add(NamespaceEnum.cc.getNamespace()+"attributionURL", config.getAttributionUrl());
+            rep.add("http://creativecommons.org/ns#attributionURL", config.getAttributionUrl());
         }
         //add the licenses
         if(config.getLicenses() != null){
@@ -764,10 +776,10 @@ public class ReferencedSiteRootResource 
                 }
                 //if defined add the name to dc:license
                 if(license.getName() != null){
-                    rep.add(NamespaceEnum.dcTerms.getNamespace()+"license", licenseUrl);
+                    rep.add("http://purl.org/dc/terms/license", licenseUrl);
                 }
                 //link to the license via cc:license
-                rep.add(NamespaceEnum.cc.getNamespace()+"license", licenseUrl);
+                rep.add("http://creativecommons.org/ns#license", licenseUrl);
             }
         }
         if(config.getEntityPrefixes() != null){
@@ -797,15 +809,15 @@ public class ReferencedSiteRootResource 
         RdfRepresentation rep = valueFactory.createRepresentation(id);
         
         if(license.getName() != null){
-            rep.add(NamespaceEnum.dcTerms.getNamespace()+"license", license.getName());
-            rep.add(NamespaceEnum.rdfs+"label", license.getName());
-            rep.add(NamespaceEnum.dcTerms+"title", license.getName());
+            rep.add("http://purl.org/dc/terms/license", license.getName());
+            rep.add("http://www.w3.org/2000/01/rdf-schema#label", license.getName());
+            rep.add("http://purl.org/dc/terms/title", license.getName());
         }
         if(license.getText() != null){
-            rep.add(NamespaceEnum.rdfs+"description", license.getText());
+            rep.add("http://www.w3.org/2000/01/rdf-schema#description", license.getText());
             
         }
-        rep.add(NamespaceEnum.cc.getNamespace()+"licenseUrl", 
+        rep.add("http://creativecommons.org/ns#licenseUrl", 
             license.getUrl() == null ? id:license.getUrl());
         return rep;
     }

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java Thu Dec  6 10:43:52 2012
@@ -42,6 +42,7 @@ import java.util.Iterator;
 import java.util.Set;
 import java.util.TreeSet;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DefaultValue;
 import javax.ws.rs.FormParam;
@@ -60,13 +61,13 @@ import javax.ws.rs.core.Response.Respons
 import javax.ws.rs.core.Response.Status;
 import javax.ws.rs.core.UriInfo;
 
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.ontologies.RDFS;
 import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.commons.viewable.Viewable;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
-import org.apache.stanbol.commons.web.base.utils.MediaTypeUtil;
 import org.apache.stanbol.entityhub.core.query.QueryResultListImpl;
 import org.apache.stanbol.entityhub.jersey.utils.JerseyUtils;
 import org.apache.stanbol.entityhub.ldpath.EntityhubLDPath;
@@ -98,6 +99,8 @@ public class SiteManagerRootResource ext
 
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    private NamespacePrefixService nsPrefixService;
+
     public static final Set<String> RDF_MEDIA_TYPES = new TreeSet<String>(Arrays.asList(N3, N_TRIPLE,
         RDF_XML, TURTLE, X_TURTLE, RDF_JSON));
 
@@ -113,8 +116,9 @@ public class SiteManagerRootResource ext
     private static final int DEFAULT_FIND_RESULT_LIMIT = 5;
 
     
-    public SiteManagerRootResource() {
+    public SiteManagerRootResource(@Context ServletContext context) {
         super();
+        nsPrefixService = ContextHelper.getServiceFromContext(NamespacePrefixService.class, context);
     }
 
     @OPTIONS
@@ -270,7 +274,7 @@ public class SiteManagerRootResource ext
     @POST
     @Path("/find")
     public Response findEntity(@FormParam(value = "name") String name,
-                               @FormParam(value = "field") String field,
+                               @FormParam(value = "field") String parsedField,
                                @FormParam(value = "lang") String language,
                                // @FormParam(value="select") String select,
                                @FormParam(value = "limit") Integer limit,
@@ -294,16 +298,26 @@ public class SiteManagerRootResource ext
                     .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
             }
         }
-        if (field == null) {
-            field = DEFAULT_FIND_FIELD;
+        final String property;
+        if (parsedField == null) {
+            property = DEFAULT_FIND_FIELD;
         } else {
-            field = field.trim();
-            if (field.isEmpty()) {
-                field = DEFAULT_FIND_FIELD;
+            parsedField = parsedField.trim();
+            if (parsedField.isEmpty()) {
+                property = DEFAULT_FIND_FIELD;
+            } else {
+                property = nsPrefixService.getFullName(parsedField);
+                if(property == null){
+                    String messsage = String.format("The prefix '%s' of the parsed field '%' is not "
+                        + "mapped to any namespace. Please parse the full URI instead!\n",
+                        NamespaceMappingUtils.getPrefix(parsedField),parsedField);
+                    return Response.status(Status.BAD_REQUEST)
+                            .entity(messsage)
+                            .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
+                }
             }
-        }
-        
-        FieldQuery query = JerseyUtils.createFieldQueryForFindRequest(name, field, language,
+        }        
+        FieldQuery query = JerseyUtils.createFieldQueryForFindRequest(name, property, language,
             limit == null || limit < 1 ? DEFAULT_FIND_RESULT_LIMIT : limit, offset,ldpath);
         return executeQuery(ContextHelper.getServiceFromContext(
             SiteManager.class, servletContext), query, acceptedMediaType, headers);

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/BaseGoogleRefineReconcileResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/BaseGoogleRefineReconcileResource.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/BaseGoogleRefineReconcileResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/BaseGoogleRefineReconcileResource.java Thu Dec  6 10:43:52 2012
@@ -31,9 +31,10 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.FormParam;
 import javax.ws.rs.GET;
 import javax.ws.rs.OPTIONS;
@@ -46,7 +47,10 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.ResponseBuilder;
 
+import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.commons.viewable.Viewable;
+import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.commons.web.base.CorsHelper;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
 import org.apache.stanbol.commons.web.base.utils.MediaTypeUtil;
@@ -55,7 +59,6 @@ import org.apache.stanbol.entityhub.jers
 import org.apache.stanbol.entityhub.jersey.grefine.ReconcileValue;
 import org.apache.stanbol.entityhub.jersey.grefine.Utils;
 import org.apache.stanbol.entityhub.servicesapi.EntityhubException;
-import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.defaults.SpecialFieldEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.Reference;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
@@ -89,8 +92,8 @@ public abstract class BaseGoogleRefineRe
 
     private final Logger log = LoggerFactory.getLogger(BaseGoogleRefineReconcileResource.class);
 
-    private static final String NAME_FIELD = NamespaceEnum.rdfs+"label";
-    private static final String TYPE_FIELD = NamespaceEnum.rdf+"type";
+    private static final String NAME_FIELD = "http://www.w3.org/2000/01/rdf-schema#label";
+    private static final String TYPE_FIELD = "http://www.w3.org/1999/02/22-rdf-syntax-ns#type";
     private static final Collection<String> SELECTED_FIELDS = Collections.unmodifiableList(
         Arrays.asList(NAME_FIELD,TYPE_FIELD));
 
@@ -106,9 +109,13 @@ public abstract class BaseGoogleRefineRe
         }
         
     };
+    
+    protected final NamespacePrefixService nsPrefixService;
 
-    protected BaseGoogleRefineReconcileResource(){
+    protected BaseGoogleRefineReconcileResource(ServletContext context){
         super();
+        nsPrefixService = ContextHelper.getServiceFromContext(
+            NamespacePrefixService.class, context);
     }
     
     @OPTIONS
@@ -142,7 +149,7 @@ public abstract class BaseGoogleRefineRe
         if(query != null){
             log.debug("query: {}",query);
             try {
-                jResult = reconcile(ReconcileQuery.parseQuery(query));
+                jResult = reconcile(ReconcileQuery.parseQuery(query,nsPrefixService));
             } catch (JSONException e) {
                 throw new WebApplicationException(
                     Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
@@ -157,7 +164,7 @@ public abstract class BaseGoogleRefineRe
         } else if(queries != null){
             log.debug("multi-query: {}",queries);
             try {
-                jResult = reoncile(ReconcileQuery.parseQueries(queries));
+                jResult = reoncile(ReconcileQuery.parseQueries(queries,nsPrefixService));
             } catch (JSONException e) {
                 throw new WebApplicationException(
                     Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
@@ -323,9 +330,18 @@ public abstract class BaseGoogleRefineRe
                         fullText.add(text);
                     }
                 } else if(property.getName().equalsIgnoreCase("similarity")){
-                    similarityFields.add(property.getParameter() != null ? 
-                            NamespaceEnum.getFullName(property.getParameter()) :
-                                SpecialFieldEnum.fullText.getUri()); //the default
+                    String propUri = property.getParameter() != null ? 
+                            nsPrefixService.getFullName(property.getParameter()) :
+                                SpecialFieldEnum.fullText.getUri();
+                    if(propUri != null){
+                        similarityFields.add(propUri);
+                    } else {
+                        //TODO: maybe throw an Exception instead
+                        log.warn("Unknown prefix '{}' used by Google Refine query parameter of property '{}'! "
+                            + "Will use the full text field as fallback",
+                            NamespaceMappingUtils.getPrefix(property.getParameter()),property);
+                        similarityFields.add(SpecialFieldEnum.fullText.getUri());
+                    }
                     for(String text : texts){ //Append the text values to the context
                         similarityContext.append(text).append(' ');
                     }

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/EntityhubReconcileResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/EntityhubReconcileResource.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/EntityhubReconcileResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/EntityhubReconcileResource.java Thu Dec  6 10:43:52 2012
@@ -16,7 +16,9 @@
  */
 package org.apache.stanbol.entityhub.jersey.resource.reconcile;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
 
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.entityhub.servicesapi.Entityhub;
@@ -30,8 +32,8 @@ public class EntityhubReconcileResource 
 
     private Entityhub _entityhub;
     
-    public EntityhubReconcileResource() {
-        super();
+    public EntityhubReconcileResource(@Context ServletContext context) {
+        super(context);
     }
     private Entityhub getEntityhub(){
         if(_entityhub == null){

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/ReferencedSiteReconcileResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/ReferencedSiteReconcileResource.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/ReferencedSiteReconcileResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/ReferencedSiteReconcileResource.java Thu Dec  6 10:43:52 2012
@@ -16,9 +16,11 @@
  */
 package org.apache.stanbol.entityhub.jersey.resource.reconcile;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
 
@@ -39,10 +41,9 @@ public class ReferencedSiteReconcileReso
     private SiteManager _siteManager;
     private final String siteId;
     
-    
-    
-    public ReferencedSiteReconcileResource(@PathParam(value = "site") String siteId) {
-       super();
+    public ReferencedSiteReconcileResource(@Context ServletContext context,
+                                           @PathParam(value = "site") String siteId) {
+       super(context);
        if (siteId == null || siteId.isEmpty()) {
            log.error("Missing path parameter site={}", siteId);
            throw new WebApplicationException(Response.Status.NOT_FOUND);

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/SiteManagerReconcileResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/SiteManagerReconcileResource.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/SiteManagerReconcileResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/reconcile/SiteManagerReconcileResource.java Thu Dec  6 10:43:52 2012
@@ -16,7 +16,9 @@
  */
 package org.apache.stanbol.entityhub.jersey.resource.reconcile;
 
+import javax.servlet.ServletContext;
 import javax.ws.rs.Path;
+import javax.ws.rs.core.Context;
 
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.entityhub.core.query.DefaultQueryFactory;
@@ -31,8 +33,8 @@ public class SiteManagerReconcileResourc
 
     SiteManager _siteManager;
     
-    public SiteManagerReconcileResource() {
-        super();
+    public SiteManagerReconcileResource(@Context ServletContext context) {
+        super(context);
     }
 
     private SiteManager getSiteManager(){

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/JerseyUtils.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/JerseyUtils.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/JerseyUtils.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/JerseyUtils.java Thu Dec  6 10:43:52 2012
@@ -43,7 +43,6 @@ import java.util.Set;
 import java.util.StringTokenizer;
 
 import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.MessageBodyReader;

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java Thu Dec  6 10:43:52 2012
@@ -38,11 +38,9 @@ import javax.ws.rs.core.Response.Respons
 import javax.ws.rs.core.Response.Status;
 
 import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
 import org.apache.stanbol.commons.viewable.Viewable;
 import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
-import org.apache.stanbol.commons.web.base.utils.MediaTypeUtil;
 import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
 import org.apache.stanbol.entityhub.jersey.resource.EntityhubRootResource;
 import org.apache.stanbol.entityhub.jersey.resource.ReferencedSiteRootResource;
@@ -50,7 +48,6 @@ import org.apache.stanbol.entityhub.jers
 import org.apache.stanbol.entityhub.ldpath.EntityhubLDPath;
 import org.apache.stanbol.entityhub.ldpath.backend.AbstractBackend;
 import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory;
-import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.Reference;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
 import org.apache.stanbol.entityhub.servicesapi.model.ValueFactory;
@@ -76,7 +73,7 @@ public class LDPathHelper {
      */
     public static final FieldMapping<Double,Object> RESULT_SCORE_MAPPING = 
         new FieldMapping<Double,Object>(RdfResourceEnum.resultScore.getUri(), 
-            NamespaceEnum.xsd+"double", new PropertySelector<Object>(
+            "http://www.w3.org/2001/XMLSchema#double", new PropertySelector<Object>(
                     InMemoryValueFactory.getInstance().createReference(
                         RdfResourceEnum.resultScore.getUri())), 
                     new DoubleTransformer<Object>(), null);