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 [3/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/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java Thu Dec  6 10:43:52 2012
@@ -36,47 +36,9 @@ final class EntityToJSON {
     private EntityToJSON() { /* do not create instances of utility classes */}
 
     static JSONObject toJSON(Entity entity) throws JSONException {
-        JSONObject jSign;
-//        if (entity instanceof Symbol) {
-//            jSign = writeSymbolAsJSON((Symbol) entity);
-//        } else if (entity instanceof EntityMapping) {
-//            jSign = writeEntityMappingAsJSON((EntityMapping) entity);
-//        } else {
-            jSign = convertEntityToJSON(entity);
-//        }
-        return jSign;
+        return convertEntityToJSON(entity);
     }
 
-//    private static JSONObject writeSymbolAsJSON(Symbol symbol) throws JSONException {
-//        JSONObject jSymbol = convertSignToJSON(symbol);
-//        jSymbol.put("label", symbol.getLabel());
-//        Iterator<Text> descriptions = symbol.getDescriptions();
-//        if (descriptions.hasNext()) {
-//            jSymbol.put("description", convertFieldValuesToJSON(descriptions));
-//        }
-//        Collection<String> value = ModelUtils.asCollection(symbol.getPredecessors());
-//        if (!value.isEmpty()) {
-//            jSymbol.put("predecessors", value);
-//        }
-//        value = ModelUtils.asCollection(symbol.getSuccessors());
-//        if (!value.isEmpty()) {
-//            jSymbol.put("successors", new JSONArray());
-//        }
-//        jSymbol.put("stateUri", symbol.getState().getUri());
-//        jSymbol.put("state", symbol.getState().name());
-//        return jSymbol;
-//    }
-
-//    private static JSONObject writeEntityMappingAsJSON(EntityMapping entityMapping) throws JSONException {
-//        JSONObject jEntityMapping = convertSignToJSON(entityMapping);
-//        jEntityMapping.put("symbol", entityMapping.getTargetId());
-//        jEntityMapping.put("entity", entityMapping.getSourceId());
-//        jEntityMapping.put("stateUri", entityMapping.getState().getUri());
-//        jEntityMapping.put("state", entityMapping.getState().name());
-//        return jEntityMapping;
-//    }
-
-
     /**
      * @param entity
      * @return

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java Thu Dec  6 10:43:52 2012
@@ -21,7 +21,6 @@ import org.apache.clerezza.rdf.core.MGra
 import org.apache.clerezza.rdf.core.TripleCollection;
 import org.apache.clerezza.rdf.core.TypedLiteral;
 import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.rdf.ontologies.FOAF;
 import org.apache.clerezza.rdf.ontologies.RDF;
@@ -49,7 +48,7 @@ final class EntityToRDF {
     private final static UriRef FOAF_PRIMARY_TOPIC = FOAF.primaryTopic;
     private final static UriRef FOAF_PRIMARY_TOPIC_OF = FOAF.isPrimaryTopicOf;
     private final static UriRef signSite = new UriRef(RdfResourceEnum.site.getUri());
-    private final static UriRef ENTITY_TYPE = new UriRef(RdfResourceEnum.Entity.getUri());
+//    private final static UriRef ENTITY_TYPE = new UriRef(RdfResourceEnum.Entity.getUri());
     private final static RdfValueFactory valueFactory = RdfValueFactory.getInstance();
     /**
      * The literal factory used (currently {@link LiteralFactory#getInstance()},

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java Thu Dec  6 10:43:52 2012
@@ -22,9 +22,9 @@ import java.util.EnumSet;
 import java.util.Map.Entry;
 import java.util.Set;
 
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.ldpath.query.LDPathSelect;
 import org.apache.stanbol.entityhub.servicesapi.defaults.DataTypeEnum;
-import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.query.Constraint;
 import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
 import org.apache.stanbol.entityhub.servicesapi.query.RangeConstraint;
@@ -51,13 +51,13 @@ final class FieldQueryToJSON {
      * @return the {@link JSONObject}
      * @throws JSONException
      */
-    static JSONObject toJSON(FieldQuery query) throws JSONException {
+    static JSONObject toJSON(FieldQuery query,NamespacePrefixService nsPrefixService) throws JSONException {
         JSONObject jQuery = new JSONObject();
         jQuery.put("selected", new JSONArray(query.getSelectedFields()));
         JSONArray constraints = new JSONArray();
         jQuery.put("constraints", constraints);
         for (Entry<String, Constraint> fieldConstraint : query) {
-            JSONObject jFieldConstraint = convertConstraintToJSON(fieldConstraint.getValue());
+            JSONObject jFieldConstraint = convertConstraintToJSON(fieldConstraint.getValue(),nsPrefixService);
             jFieldConstraint.put("field", fieldConstraint.getKey()); //add the field
             constraints.put(jFieldConstraint); //add fieldConstraint
         }
@@ -79,10 +79,12 @@ final class FieldQueryToJSON {
      * Converts a {@link Constraint} to JSON
      *
      * @param constraint the {@link Constraint}
+     * @param nsPrefixService Optionally the service that is used to convert data type
+     * URIs to '{prefix}:{localname}'
      * @return the JSON representation
      * @throws JSONException
      */
-    private static JSONObject convertConstraintToJSON(Constraint constraint) throws JSONException {
+    private static JSONObject convertConstraintToJSON(Constraint constraint, NamespacePrefixService nsPrefixService) throws JSONException {
         JSONObject jConstraint = new JSONObject();
         jConstraint.put("type", constraint.getType().name());
         switch (constraint.getType()) {
@@ -107,11 +109,14 @@ final class FieldQueryToJSON {
                     Collection<String> dataTypes = valueConstraint.getDataTypes();
                     if (dataTypes != null && !dataTypes.isEmpty()) {
                         if(dataTypes.size() == 1) {
-                            jConstraint.put("datatype", NamespaceEnum.getShortName(dataTypes.iterator().next()));
+                            String dataType = dataTypes.iterator().next();
+                            jConstraint.put("datatype",
+                                nsPrefixService != null ? nsPrefixService.getShortName(dataType) : dataType);
                         } else {
                             ArrayList<String> dataTypeValues = new ArrayList<String>(dataTypes.size());
                             for(String dataType : dataTypes){
-                                dataTypeValues.add(NamespaceEnum.getShortName(dataType));
+                                dataTypeValues.add(nsPrefixService != null ?
+                                        nsPrefixService.getShortName(dataType) : dataType);
                             }
                             jConstraint.put("datatype", dataTypeValues);
                         }

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java Thu Dec  6 10:43:52 2012
@@ -45,6 +45,7 @@ import org.apache.clerezza.rdf.core.MGra
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.rdf.core.serializedform.Serializer;
 import org.apache.commons.io.IOUtils;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.commons.web.base.ContextHelper;
 import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
 import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
@@ -75,7 +76,6 @@ public class QueryResultListWriter imple
     }
     public static final String DEFAULT_ENCODING = "UTF-8";
     
-    @SuppressWarnings("unused")
     private final Logger log = LoggerFactory.getLogger(QueryResultListWriter.class);
     
     @Context
@@ -84,6 +84,10 @@ public class QueryResultListWriter imple
     protected Serializer getSerializer() {
         return ContextHelper.getServiceFromContext(Serializer.class, servletContext);
     }
+    
+    private NamespacePrefixService getNsPrefixService(){
+        return ContextHelper.getServiceFromContext(NamespacePrefixService.class, servletContext);
+    }
 
     @Override
     public long getSize(QueryResultList<?> result, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
@@ -109,22 +113,23 @@ public class QueryResultListWriter imple
         }
         if (APPLICATION_JSON.equals(mediaTypeString)) {
             try {
-                IOUtils.write(QueryResultsToJSON.toJSON(resultList).toString(4), entityStream,encoding);
+                IOUtils.write(QueryResultsToJSON.toJSON(resultList,getNsPrefixService())
+                    .toString(4), entityStream,encoding);
             } catch (JSONException e) {
                 throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
             }
         } else { //RDF
             MGraph resultGraph = QueryResultsToRDF.toRDF(resultList);
-            addFieldQuery(resultList.getQuery(),resultGraph);
+            addFieldQuery(resultList.getQuery(),resultGraph, getNsPrefixService());
             getSerializer().serialize(entityStream, resultGraph, mediaTypeString);
         }
     }
-    private void addFieldQuery(FieldQuery query, MGraph resultGraph) {
+    private void addFieldQuery(FieldQuery query, MGraph resultGraph, NamespacePrefixService nsPrefixService) {
         if(query == null){
             return;
         }
         try {
-            JSONObject fieldQueryJson = FieldQueryToJSON.toJSON(query);
+            JSONObject fieldQueryJson = FieldQueryToJSON.toJSON(query,nsPrefixService);
             if(fieldQueryJson != null){
                 //add the triple with the fieldQuery
                 resultGraph.add(new TripleImpl(

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToJSON.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToJSON.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToJSON.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToJSON.java Thu Dec  6 10:43:52 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.stanbol.entityhub.jersey.writers;
 
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.servicesapi.model.Entity;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
 import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
@@ -27,10 +28,10 @@ final class QueryResultsToJSON {
 
     private QueryResultsToJSON() { /* do not create instances of utility classes */}
 
-    static <T> JSONObject toJSON(QueryResultList<?> resultList) throws JSONException{
+    static <T> JSONObject toJSON(QueryResultList<?> resultList, NamespacePrefixService nsPrefixService) throws JSONException{
         JSONObject jResultList = new JSONObject();
         if(resultList.getQuery() != null){
-            jResultList.put("query", FieldQueryToJSON.toJSON(resultList.getQuery()));
+            jResultList.put("query", FieldQueryToJSON.toJSON(resultList.getQuery(),nsPrefixService));
         }
         jResultList.put("results", convertResultsToJSON(resultList,resultList.getType()));
         return jResultList;

Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java Thu Dec  6 10:43:52 2012
@@ -17,7 +17,6 @@
 package org.apache.stanbol.entityhub.jersey.writers;
 
 import java.io.ByteArrayOutputStream;
-import java.io.StringWriter;
 import java.nio.charset.Charset;
 import java.util.Iterator;
 

Modified: stanbol/trunk/entityhub/jersey/src/test/java/org/apache/stanbol/entityhub/jersey/parsers/RepresetnationReaderTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/test/java/org/apache/stanbol/entityhub/jersey/parsers/RepresetnationReaderTest.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/test/java/org/apache/stanbol/entityhub/jersey/parsers/RepresetnationReaderTest.java (original)
+++ stanbol/trunk/entityhub/jersey/src/test/java/org/apache/stanbol/entityhub/jersey/parsers/RepresetnationReaderTest.java Thu Dec  6 10:43:52 2012
@@ -1,6 +1,7 @@
 package org.apache.stanbol.entityhub.jersey.parsers;
 
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.ext.RuntimeDelegate;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -9,7 +10,6 @@ import org.slf4j.LoggerFactory;
 
 import com.sun.jersey.api.representation.Form;
 import com.sun.jersey.server.impl.provider.RuntimeDelegateImpl;
-import javax.ws.rs.ext.RuntimeDelegate;
 
 public class RepresetnationReaderTest {
 

Modified: stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/ManagedSiteComponent.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/ManagedSiteComponent.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/ManagedSiteComponent.java (original)
+++ stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/ManagedSiteComponent.java Thu Dec  6 10:43:52 2012
@@ -31,6 +31,9 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
 import org.apache.stanbol.entityhub.core.utils.SiteUtils;
 import org.apache.stanbol.entityhub.servicesapi.site.ManagedSite;
@@ -104,8 +107,8 @@ public class ManagedSiteComponent {
 
     private ServiceRegistration managedSiteRegistration;
     
-//    @Reference(cardinality=ReferenceCardinality.OPTIONAL_UNARY)
-//    protected ConfigurationAdmin configAdmin;
+    @Reference(cardinality=ReferenceCardinality.OPTIONAL_UNARY)
+    protected NamespacePrefixService nsPrefixService;
     /**
      * Activates this {@link ManagedSiteComponent}. This might be overridden to
      * perform additional configuration. In such cases super should be called
@@ -236,7 +239,7 @@ public class ManagedSiteComponent {
     }
     
     protected void activateManagedSite(Yard yard) {
-        managedSite = new YardSite(yard,siteConfiguration);
+        managedSite = new YardSite(yard,siteConfiguration, nsPrefixService);
         managedSiteRegistration = bundleContext.registerService(
             new String[]{ManagedSite.class.getName(), Site.class.getName()},
             managedSite, siteConfiguration.getConfiguration());

Modified: stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/impl/YardSite.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/impl/YardSite.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/impl/YardSite.java (original)
+++ stanbol/trunk/entityhub/site/managed/src/main/java/org/apache/stanbol/entityhub/site/managed/impl/YardSite.java Thu Dec  6 10:43:52 2012
@@ -22,6 +22,7 @@ import java.io.InputStream;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
 import org.apache.stanbol.entityhub.core.mapping.DefaultFieldMapperImpl;
 import org.apache.stanbol.entityhub.core.mapping.FieldMappingUtils;
 import org.apache.stanbol.entityhub.core.mapping.ValueConverterFactory;
@@ -65,10 +66,15 @@ public final class YardSite implements M
     private SiteConfiguration config;
     private Map<String,Object> siteMetadata;
     private FieldMapper fieldMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
+    /**
+     * used to support '{prefix}:{loacalname}' configurations in the {@link SiteConfiguration}
+     */
+    private NamespacePrefixService nsPrefixService;
     
-    public YardSite(Yard yard, SiteConfiguration config) {
+    public YardSite(Yard yard, SiteConfiguration config, NamespacePrefixService nsPrefixService) {
         this.yard = yard;
         this.config = config;
+        this.nsPrefixService = nsPrefixService;
         this.siteMetadata = extractSiteMetadata(config,InMemoryValueFactory.getInstance());
         //all entities of managed sites are locally cached - so we can add this
         //to the site metadata
@@ -77,7 +83,7 @@ public final class YardSite implements M
         if(config.getFieldMappings() != null){
             log.debug(" > Initialise configured field mappings");
             for(String configuredMapping : config.getFieldMappings()){
-                FieldMapping mapping = FieldMappingUtils.parseFieldMapping(configuredMapping);
+                FieldMapping mapping = FieldMappingUtils.parseFieldMapping(configuredMapping,nsPrefixService);
                 if(mapping != null){
                     log.debug("   - add FieldMapping {}",mapping);
                     fieldMapper.addMapping(mapping);

Modified: stanbol/trunk/integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/pom.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/integration-tests/pom.xml (original)
+++ stanbol/trunk/integration-tests/pom.xml Thu Dec  6 10:43:52 2012
@@ -163,6 +163,24 @@
       <version>0.10.0-SNAPSHOT</version>
     </dependency>
 
+    <!-- namespace prefixes mappings -->
+    <!-- used for the Stress Test Tool configuration -->
+    <dependency>
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.commons.namespaceprefix.service</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </dependency>
+    <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>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>

Modified: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java (original)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java Thu Dec  6 10:43:52 2012
@@ -49,12 +49,14 @@ import org.apache.http.params.BasicHttpP
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.CoreProtocolPNames;
 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.namespaceprefix.service.StanbolNamespacePrefixService;
 import org.apache.stanbol.commons.testing.http.Request;
 import org.apache.stanbol.commons.testing.http.RequestExecutor;
 import org.apache.stanbol.enhancer.servicesapi.helper.execution.Execution;
 import org.apache.stanbol.enhancer.servicesapi.helper.execution.ExecutionMetadata;
 import org.apache.stanbol.enhancer.servicesapi.rdf.Properties;
-import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -69,7 +71,7 @@ import org.slf4j.LoggerFactory;
  *
  */
 public abstract class MultiThreadedTestBase extends EnhancerTestBase {
-
+    
     /**
      * The name of the Enhancement Chain this test runs against. If not defined
      * the default chain is used.
@@ -120,7 +122,9 @@ public abstract class MultiThreadedTestB
     protected DefaultHttpClient pooledHttpClient;
     private BasicHttpParams httpParams;
     private PoolingClientConnectionManager connectionManager;
-
+    
+    private NamespacePrefixService nsPrefixService;
+    
     protected MultiThreadedTestBase() {
         this(new String[]{});
     }
@@ -129,6 +133,12 @@ public abstract class MultiThreadedTestB
         super(null,assertEngines);
         //set the endpoint to the default
         setEndpoint(null, ENABLE_EXECUTION_METADATA);
+        try {
+            nsPrefixService = new StanbolNamespacePrefixService(null);
+        } catch (IOException e) {
+            log.warn("Unable to initialise NamespacePrefixService. '{prefix}:{localname}' type "
+                + "will not be supported and cause IllegalArgumentExceptions when used!",e);
+        }
     }
     
     @BeforeClass
@@ -150,7 +160,7 @@ public abstract class MultiThreadedTestB
      * @return the Iterator over the contents in the test data
      * @throws IOException on any error while accessing the parsed test data
      */
-    private static Iterator<String> initTestData(TestSettings settings) throws IOException {
+    private Iterator<String> initTestData(TestSettings settings) throws IOException {
         log.info("Read Testdata from '{}'",settings.getTestData());
         File testFile = new File(settings.getTestData());
         InputStream is = null;
@@ -248,7 +258,7 @@ public abstract class MultiThreadedTestB
      * @param mediaType the Media-Type of the stream. MUST BE supported by
      * the Apache Clerezza RDF parsers.
      */
-    private static Iterator<String> createRdfDataIterator(InputStream is, MediaType mediaType, final String propertyString) {
+    private Iterator<String> createRdfDataIterator(InputStream is, MediaType mediaType, final String propertyString) {
         final SimpleMGraph graph = new SimpleMGraph();
         try {
             rdfParser.parse(graph, is, mediaType.toString());
@@ -272,8 +282,9 @@ public abstract class MultiThreadedTestB
                         property = null; //wildcard
                         log.info("Iterate over values of all Triples");
                     } else {
-                        property = new UriRef(NamespaceEnum.getFullName(propertyString));
-                        log.info("Iterate over values of property {}", propertyString);
+                        property = new UriRef(
+                            NamespaceMappingUtils.getConfiguredUri(nsPrefixService, propertyString));
+                        log.info("Iterate over values of property {}", property);
                     }
                     it = graph.filter(null, property, null);
                 }

Modified: stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml?rev=1417801&r1=1417800&r2=1417801&view=diff
==============================================================================
--- stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml (original)
+++ stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml Thu Dec  6 10:43:52 2012
@@ -344,6 +344,11 @@
       <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.stanbol</artifactId>
       <version>0.10.0-SNAPSHOT</version>
     </bundle>
+    <bundle> <!-- Provides the namespace prefixes managed by http://prefix.cc -->
+      <groupId>org.apache.stanbol</groupId>
+      <artifactId>org.apache.stanbol.commons.namespaceprefix.provider.prefixcc</artifactId>
+      <version>0.10.0-SNAPSHOT</version>
+    </bundle>
     <!-- OWL libraries and utilities -->
     <bundle>
       <groupId>org.apache.stanbol</groupId>