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 2011/07/26 10:13:12 UTC

svn commit: r1151013 - in /incubator/stanbol/trunk: data/sites/dbpediadefault/ entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/mapping/ entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults...

Author: rwesten
Date: Tue Jul 26 08:13:07 2011
New Revision: 1151013

URL: http://svn.apache.org/viewvc?rev=1151013&view=rev
Log:
Changes:

1. dbpedia default data:

* Added the following Mappings for the generation of the default data index:

    geo:lat | d=xsd:double
    geo:long | d=xsd:double
    geo:alt | d=xsd:int
    dbp-ont:elevation | d=xsd:int > geo:alt

    skos:*
    skos:prefLabel > rdfs:label
    skos:altLabel > rdfs:label
    skos:hiddenLabel > rdfs:label

    foaf:homepage | d=xsd:anyURI
    foaf:depiction | d=xsd:anyURI

    dbp-ont:birthDate | d=xsd:dateTime
    dbp-ont:deathDate | d=xsd:dateTime
    dbp-ont:populationTotal | d=xsd:long

 This increases the side of the index from ~14MByte to ~17MByte but allows to test/show most of the FieldQuery features. A fair tradeoff in my opinion.

* Increased the version of this bundle to 1.0.1-incubation
* Updated the parent POM and all the launcher to this version
* The new index archive is now hosted on my home directory @Salzburg Research

2. Entityhub Core

* FieldMapping / ValueConverter

Improved the converter for discrete numbers (Integer,Long,Int,Short,Byte) to support also the conversion of floating point values that happen to be discrete numbers.
In addition the conversion of string values such as "12.0" is now supported.

This greatly improves conversion of values that happen to be discrete numbers but are encoded as floating points (e.g. a high percentage of elevation data in dbpedia)

* NamespaceEnum

Added a utility method for getting the short name (prefix:localName) based on the full qualified URI.

3. STANBOL-298: Implementation of all five points listed by this Issue

4. STANBOL-300: Implementation of all three points listed by this Issue

Added:
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/fieldquerydocumentation.ftl
Modified:
    incubator/stanbol/trunk/data/sites/dbpediadefault/pom.xml
    incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/mapping/ValueConverterFactory.java
    incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_query.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/query.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_query.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/query.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl
    incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml
    incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml
    incubator/stanbol/trunk/launchers/stable/src/main/bundles/list.xml
    incubator/stanbol/trunk/launchers/stateless/src/main/bundles/list.xml
    incubator/stanbol/trunk/parent/pom.xml

Modified: incubator/stanbol/trunk/data/sites/dbpediadefault/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/data/sites/dbpediadefault/pom.xml?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/data/sites/dbpediadefault/pom.xml (original)
+++ incubator/stanbol/trunk/data/sites/dbpediadefault/pom.xml Tue Jul 26 08:13:07 2011
@@ -29,7 +29,7 @@
 
   <groupId>org.apache.stanbol</groupId>
   <artifactId>org.apache.stanbol.data.sites.dbpedia.default</artifactId>
-  <version>1.0.0-incubating</version>
+  <version>1.0.1-incubating</version>
   <packaging>bundle</packaging>
 
   <name>Apache Stanbol Data: DBpedia.org defaultdata version</name>
@@ -54,7 +54,7 @@
   </scm>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <dbpedia.default.index.url>http://dl.dropbox.com/u/5743203/IKS/dbpedia/3.6/dbpedia_43k.solrindex.zip</dbpedia.default.index.url>
+    <dbpedia.default.index.url>http://www.salzburgresearch.at/~rwesten/stanbol/dbpedia_43k.solrindex.zip</dbpedia.default.index.url>
     <dbpedia.default.path>org/apache/stanbol/data/site/dbpedia/default</dbpedia.default.path>
     <dbpedia.default.index.path>${dbpedia.default.path}/index</dbpedia.default.index.path>
     <dbpedia.default.config.path>${dbpedia.default.path}/config</dbpedia.default.config.path>

Modified: incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/mapping/ValueConverterFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/mapping/ValueConverterFactory.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/mapping/ValueConverterFactory.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/core/src/main/java/org/apache/stanbol/entityhub/core/mapping/ValueConverterFactory.java Tue Jul 26 08:13:07 2011
@@ -226,12 +226,23 @@ public class ValueConverterFactory {
             }
             if(value instanceof Byte){
                 return (Byte)value;
+            } else if(value instanceof Long || value instanceof Integer || value instanceof Short){
+                long longValue = ((Long)value).longValue();
+                if(longValue <= Byte.MAX_VALUE && longValue >= Byte.MIN_VALUE){
+                    return (byte)longValue;
+                } else {
+                    return null;
+                }
+            } else if(value instanceof Float || value instanceof Double){
+                try {
+                    return BigDecimal.valueOf(((Number)value).doubleValue()).byteValueExact();
+                } catch (ArithmeticException e) { return null; }
             } else {
                 try {
-                    return Byte.parseByte(value.toString());
-                } catch (NumberFormatException e){ return null;}
-            }
-        }
+                    return new BigDecimal(value.toString()).byteValueExact();
+                } catch (NumberFormatException e){ return null;
+                } catch (ArithmeticException e) { return null; }
+            }        }
         @Override
         public String getDataType() {return DataTypeEnum.Byte.getUri();}
 
@@ -244,10 +255,22 @@ public class ValueConverterFactory {
             }
             if(value instanceof Short){
                 return (Short)value;
+            } else if(value instanceof Long || value instanceof Integer){
+                long longValue = ((Long)value).longValue();
+                if(longValue <= Short.MAX_VALUE && longValue >= Short.MIN_VALUE){
+                    return (short)longValue;
+                } else {
+                    return null;
+                }
+            } else if(value instanceof Float || value instanceof Double){
+                try {
+                    return BigDecimal.valueOf(((Number)value).doubleValue()).shortValueExact();
+                } catch (ArithmeticException e) { return null; }
             } else {
                 try {
-                    return Short.parseShort(value.toString());
-                } catch (NumberFormatException e){ return null;}
+                    return new BigDecimal(value.toString()).shortValueExact();
+                } catch (NumberFormatException e){ return null;
+                } catch (ArithmeticException e) { return null; }
             }
         }
         @Override
@@ -262,10 +285,22 @@ public class ValueConverterFactory {
             }
             if(value instanceof Integer){
                 return (Integer)value;
+            } else if(value instanceof Long){
+                long longValue = ((Long)value).longValue();
+                if(longValue <= Integer.MAX_VALUE && longValue >= Integer.MIN_VALUE){
+                    return (int)longValue;
+                } else {
+                    return null;
+                }
+            } else if(value instanceof Float || value instanceof Double){
+                try {
+                    return BigDecimal.valueOf(((Number)value).doubleValue()).intValueExact();
+                } catch (ArithmeticException e) { return null; }
             } else {
                 try {
-                    return Integer.parseInt(value.toString());
-                } catch (NumberFormatException e){ return null;}
+                    return new BigDecimal(value.toString()).intValueExact();
+                } catch (NumberFormatException e){ return null;
+                } catch (ArithmeticException e) { return null; }
             }
         }
         @Override
@@ -280,10 +315,17 @@ public class ValueConverterFactory {
             }
             if(value instanceof Long){
                 return (Long)value;
+            } else if(value instanceof Integer){
+                return ((Integer)value).longValue();
+            } else if(value instanceof Float || value instanceof Double){
+                try {
+                    return BigDecimal.valueOf(((Number)value).doubleValue()).longValueExact();
+                } catch (ArithmeticException e) { return null; }
             } else {
                 try {
-                    return Long.parseLong(value.toString());
-                } catch (NumberFormatException e){ return null;}
+                    return new BigDecimal(value.toString()).longValueExact();
+                } catch (NumberFormatException e){ return null;
+                } catch (ArithmeticException e) { return null; }
             }
         }
         @Override
@@ -332,9 +374,10 @@ public class ValueConverterFactory {
             if(value instanceof BigInteger){
                 return (BigInteger)value;
             } else {
-                try {
-                    return new BigInteger(value.toString());
-                } catch (NumberFormatException e){ return null;}
+                try { //would also support 10000000000000000000000000000000.0
+                    return new BigDecimal(value.toString()).toBigIntegerExact();
+                } catch (NumberFormatException e){ return null;
+                } catch (ArithmeticException e) { return null; }
             }
         }
         @Override

Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/defaults/NamespaceEnum.java Tue Jul 26 08:13:07 2011
@@ -246,6 +246,30 @@ public enum NamespaceEnum {
         return shortUri;
     }
     /**
+     * Parsed the namespace of the parsed full URI by searching the last occurrence
+     * of '#' or '/' and than looks if the namespace is part of this enumeration.
+     * If a namesoace is found it is replaced by the registered prefix. If not
+     * the parsed URI is resturned
+     * @param fullUri the full uri to convert
+     * @return the converted URI or the parsed value of <code>null</code> was
+     * parsed, no local name was present (e.g. if the namespace itself was parsed)
+     * or the parsed namespace is not known.
+     */
+    public static String getShortName(String fullUri){
+        if(fullUri == null){
+            return fullUri;
+        }
+        int index = Math.max(fullUri.lastIndexOf('#'),fullUri.lastIndexOf('/'));
+        //do not convert if the parsed uri does not contain a local name
+        if(index > 0 && index+1 < fullUri.length()){
+            NamespaceEnum namespace = namespace2Prefix.get(fullUri.substring(0, index));
+            if(namespace != null){
+                return namespace.getPrefix()+':'+fullUri.substring(index+1);
+            }
+        }
+        return fullUri;
+    }
+    /**
      * @return the defaultPrefix
      */
     public boolean isDefault() {

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/parsers/FieldQueryReader.java Tue Jul 26 08:13:07 2011
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 import javax.ws.rs.WebApplicationException;
@@ -36,7 +37,12 @@ import javax.ws.rs.ext.MessageBodyReader
 import javax.ws.rs.ext.Provider;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.stanbol.entityhub.core.mapping.ValueConverterFactory;
+import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
 import org.apache.stanbol.entityhub.core.query.DefaultQueryFactory;
+import org.apache.stanbol.entityhub.servicesapi.defaults.DataTypeEnum;
+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.FieldQuery;
 import org.apache.stanbol.entityhub.servicesapi.query.FieldQueryFactory;
@@ -55,6 +61,10 @@ import org.slf4j.LoggerFactory;
 @Provider
 public class FieldQueryReader implements MessageBodyReader<FieldQuery> {
     private static final Logger log = LoggerFactory.getLogger(FieldQueryReader.class);
+    
+    private static final ValueFactory valueFactory = InMemoryValueFactory.getInstance();
+    private static final ValueConverterFactory converterFactory = ValueConverterFactory.getDefaultInstance();
+    
     @Override
     public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
         log.info("isReadable type {}, mediaType {}",type,mediaType);
@@ -264,6 +274,52 @@ public class FieldQueryReader implements
         }
         Object upperBound = jConstraint.opt("upperBound");
         Object lowerBound = jConstraint.opt("lowerBound");
+        Collection<String> datatypes = parseDatatypeProperty(jConstraint);
+        if(datatypes != null && !datatypes.isEmpty()){
+            Iterator<String> it = datatypes.iterator();
+            String datatype = it.next();
+            if(datatypes.size() > 1){ //write warning in case of multiple values
+                log.warn("Multiple datatypes are not supported by RangeConstriants!");
+                log.warn("  used: {}",datatype);
+                while(it.hasNext()){
+                    log.warn("  ignored: {}",it.next());
+                }
+            }
+            StringBuilder convertingError = null;
+            if(upperBound != null){
+                Object convertedUpperBound = converterFactory.convert(upperBound, datatype, valueFactory);
+                if(convertedUpperBound == null){
+                    log.warn("Unable to convert upper bound {} to data type {}",
+                        upperBound,datatype);
+                    convertingError = new StringBuilder();
+                    convertingError.append("Unable to convert the parsed upper bound value ")
+                        .append(upperBound).append(" to data type ").append(datatype);
+                } else { //set the converted upper bound
+                    upperBound = convertedUpperBound;
+                }
+            }
+            if(lowerBound != null){
+                Object convertedLowerBound = converterFactory.convert(lowerBound, datatype, valueFactory);
+                if(convertedLowerBound == null){
+                    log.warn("Unable to convert lower bound {} to data type {}",
+                        lowerBound,datatype);
+                    if(convertingError == null){
+                        convertingError = new StringBuilder();
+                    } else {
+                        convertingError.append('\n');
+                    }
+                    convertingError.append("Unable to convert the parsed value ")
+                        .append(lowerBound).append(" to data type ").append(datatype);
+                } else { //set the converted lower bound
+                    lowerBound = convertedLowerBound;
+                }
+            }
+            if(convertingError != null){ //if there was an error throw an exception
+                convertingError.append("Parsed Constraint: \n");
+                convertingError.append(jConstraint.toString(4));
+                throw new IllegalArgumentException(convertingError.toString());
+            }
+        }
         if(upperBound == null && lowerBound == null){
             log.warn("Range Constraint does not define an 'upperBound' nor an 'lowerBound'! " +
             		"At least one of the two MUST BE parsed for a valid RangeConstraint.");
@@ -289,7 +345,7 @@ public class FieldQueryReader implements
         boolean caseSensitive = jConstraint.optBoolean("caseSensitive", false);
         //parse patternType
         PatternType patternType;
-        String jPatternType = jConstraint.optString("patternType");
+        String jPatternType = jConstraint.optString("patternType",null);
         if(jPatternType == null){
             patternType = PatternType.none;
         } else {
@@ -310,17 +366,35 @@ public class FieldQueryReader implements
         }
         //parse languages
         Collection<String> languages;
-        JSONArray jLanguages = jConstraint.optJSONArray("languages");
-        if(jLanguages != null && jLanguages.length()>0){
-            languages = new ArrayList<String>(jLanguages.length());
-            for(int i=0;i<jLanguages.length();i++){
-                String lang = jLanguages.getString(i);
-                if(lang != null && !lang.isEmpty()){
-                    languages.add(lang);
+        String languageKey = null; //support both "languages" and "language"
+        if(jConstraint.has("language")){
+            languageKey = "language";
+        } else if(jConstraint.has("languages")){
+            log.warn("The key \"languages\" is deprecated. Use \"language\" instead.");
+            languageKey = "languages";
+        }
+        if(languageKey != null){
+            JSONArray jLanguages = jConstraint.optJSONArray(languageKey);
+            if(jLanguages != null && jLanguages.length()>0){
+                languages = new ArrayList<String>(jLanguages.length());
+                for(int i=0;i<jLanguages.length();i++){
+                    String lang = jLanguages.getString(i);
+                    if(lang != null && !lang.isEmpty()){
+                        languages.add(lang);
+                    } else if(!languages.contains(null)){
+                        languages.add(null);
+                    }
+                }
+                if(languages.isEmpty()){
+                    languages = null; //if no one was successfully added set the list back to null
+                }
+            } else {
+                String language = jConstraint.getString(languageKey);
+                if(language.isEmpty()){
+                    languages = null;
+                } else {  //add the single language
+                    languages = Collections.singletonList(language);
                 }
-            }
-            if(languages.isEmpty()){
-                languages = null; //if no one was successfully added set the list back to null
             }
         } else {
             languages = null;
@@ -332,10 +406,25 @@ public class FieldQueryReader implements
             if(jTextConstraints != null){
                 textConstraints = new ArrayList<String>(jTextConstraints.length());
                 for(int i=0;i<jTextConstraints.length();i++){
-                   textConstraints.add(jTextConstraints.getString(i));
+                    String text = jTextConstraints.getString(i);
+                    if(text != null && !text.isEmpty()){
+                        textConstraints.add(jTextConstraints.getString(i));
+                    }
                 }
             } else {
-                textConstraints = Collections.singletonList(jConstraint.getString("text"));
+                String text = jConstraint.getString("text");
+                if(text == null || text.isEmpty()){
+                    textConstraints = Collections.emptyList();
+                } else {
+                    textConstraints = Collections.singletonList(text);
+                }
+            }
+            if(textConstraints.isEmpty()){
+                StringBuilder message = new StringBuilder();
+                message.append("Parsed TextConstraint doese not define a valid (none empty) value for the 'text' property !\n");
+                message.append("Parsed Constraint: \n");
+                message.append(jConstraint.toString(4));
+                throw new IllegalArgumentException(message.toString());
             }
             constraint = new TextConstraint(textConstraints,
                 patternType,caseSensitive,
@@ -357,22 +446,7 @@ public class FieldQueryReader implements
      */
     private static Constraint parseValueConstraint(JSONObject jConstraint) throws JSONException {
         Constraint constraint;
-        Collection<String> dataTypes;
-        JSONArray jDataTypes = jConstraint.optJSONArray("dataTypes");
-        if(jDataTypes != null && jDataTypes.length()>0){
-            dataTypes = new ArrayList<String>(jDataTypes.length());
-            for(int i=0;i<jDataTypes.length();i++){
-                String dataType = jDataTypes.getString(i);
-                if(dataType != null && !dataType.isEmpty()){
-                    dataTypes.add(dataType);
-                }
-            }
-            if(dataTypes.isEmpty()){
-                dataTypes = null; //if no one was successfully added set the list back to null
-            }
-        } else {
-            dataTypes = null;
-        }
+        Collection<String> dataTypes = parseDatatypeProperty(jConstraint);
         if(jConstraint.has("value") && !jConstraint.isNull("value")){
             constraint = new ValueConstraint(jConstraint.get("value"), dataTypes);
         } else {
@@ -391,6 +465,48 @@ public class FieldQueryReader implements
      * @return
      * @throws JSONException
      */
+    private static Collection<String> parseDatatypeProperty(JSONObject jConstraint) throws JSONException {
+        Collection<String> dataTypes;
+        String dataTypeKey = null;
+        if(jConstraint.has("datatype")){
+            dataTypeKey = "datatype";
+        } else if(jConstraint.has("dataTypes")){
+            log.warn("The use of \"dataTypes\" is deprecated. Please use \"dataType\" instead");
+            dataTypeKey = "dataTypes";
+        }
+        if(dataTypeKey != null){
+            JSONArray jDataTypes = jConstraint.optJSONArray(dataTypeKey);
+            if(jDataTypes != null && jDataTypes.length()>0){
+                dataTypes = new ArrayList<String>(jDataTypes.length());
+                for(int i=0;i<jDataTypes.length();i++){
+                    String dataType = jDataTypes.getString(i);
+                    if(dataType != null && !dataType.isEmpty()){
+                        //convert prefix:localName to fill URI
+                        dataTypes.add(NamespaceEnum.getFullName(dataType));
+                    }
+                }
+                if(dataTypes.isEmpty()){
+                    dataTypes = null; //if no one was successfully added set the list back to null
+                }
+            } else {
+                String dataType = jConstraint.getString(dataTypeKey);
+                if(dataType != null && !dataType.isEmpty()){
+                    dataTypes = Collections.singleton(NamespaceEnum.getFullName(dataType));
+                } else {
+                    dataTypes = null;
+                }
+            }
+        } else {
+            dataTypes = null;
+        }
+        return dataTypes;
+    }
+
+    /**
+     * @param jConstraint
+     * @return
+     * @throws JSONException
+     */
     private static Constraint parseReferenceConstraint(JSONObject jConstraint) throws JSONException {
         Constraint constraint;
         if(jConstraint.has("value") && !jConstraint.isNull("value")){

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToJSON.java Tue Jul 26 08:13:07 2011
@@ -16,8 +16,12 @@
  */
 package org.apache.stanbol.entityhub.jersey.writers;
 
+import java.util.Date;
 import java.util.Iterator;
+import java.util.Set;
 
+import org.apache.stanbol.entityhub.core.utils.TimeUtils;
+import org.apache.stanbol.entityhub.servicesapi.defaults.DataTypeEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.Entity;
 import org.apache.stanbol.entityhub.servicesapi.model.Reference;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
@@ -134,13 +138,26 @@ final class EntityToJSON {
         JSONObject jValue = new JSONObject();
         if (value instanceof Reference) {
             jValue.put("type", "reference");
+            jValue.put("xsd:datatype", DataTypeEnum.AnyUri.getShortName());
+            jValue.put("value", ((Reference)value).getReference());
         } else if (value instanceof Text) {
             jValue.put("type", "text");
             jValue.put("xml:lang", ((Text) value).getLanguage());
+            jValue.put("value", ((Text)value).getText());
+        } else if(value instanceof Date){
+            jValue.put("type", "value");
+            jValue.put("value", TimeUtils.toString(DataTypeEnum.DateTime, (Date)value));
+            jValue.put("xsd:datatype", DataTypeEnum.DateTime.getShortName());
         } else {
-            jValue.put("type", "value");//TODO: better name? ^^
+            jValue.put("type", "value");
+            Set<DataTypeEnum> dataTypes = DataTypeEnum.getPrimaryDataTypes(value.getClass());
+            if(!dataTypes.isEmpty()){
+                jValue.put("xsd:datatype", dataTypes.iterator().next().getShortName());
+            } else {
+                jValue.put("xsd:datatype", DataTypeEnum.String.getShortName());
+            }
+            jValue.put("value", value);
         }
-        jValue.put("value", value.toString());
         return jValue;
     }
 }

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/EntityToRDF.java Tue Jul 26 08:13:07 2011
@@ -44,13 +44,18 @@ import org.apache.stanbol.entityhub.serv
 final class EntityToRDF {
     private EntityToRDF() { /* do not create instances of utility classes */}
 
-    private static UriRef FOAF_DOCUMENT = FOAF.Document;
-    private static UriRef FOAF_PRIMARY_TOPIC = FOAF.primaryTopic;
-    private static UriRef FOAF_PRIMARY_TOPIC_OF = FOAF.isPrimaryTopicOf;
-    private static UriRef signSite = new UriRef(RdfResourceEnum.site.getUri());
-    private static UriRef ENTITY_TYPE = new UriRef(RdfResourceEnum.Entity.getUri());
-    private static RdfValueFactory valueFactory = RdfValueFactory.getInstance();
-    private static LiteralFactory literalFactory = LiteralFactory.getInstance();
+    private final static UriRef FOAF_DOCUMENT = FOAF.Document;
+    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 RdfValueFactory valueFactory = RdfValueFactory.getInstance();
+    /**
+     * The literal factory used (currently {@link LiteralFactory#getInstance()},
+     * but we might use a custom one for Stanbol therefore it is better to
+     * have it as a field 
+     */
+    static final LiteralFactory literalFactory = LiteralFactory.getInstance();
 
     static MGraph toRDF(Representation representation) {
         MGraph graph = new SimpleMGraph();

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/FieldQueryToJSON.java Tue Jul 26 08:13:07 2011
@@ -16,13 +16,18 @@
  */
 package org.apache.stanbol.entityhub.jersey.writers;
 
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.EnumSet;
+import java.util.Set;
 import java.util.Map.Entry;
 
 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;
+import org.apache.stanbol.entityhub.servicesapi.query.ReferenceConstraint;
 import org.apache.stanbol.entityhub.servicesapi.query.TextConstraint;
 import org.apache.stanbol.entityhub.servicesapi.query.ValueConstraint;
 import org.codehaus.jettison.json.JSONArray;
@@ -74,32 +79,43 @@ final class FieldQueryToJSON {
         JSONObject jConstraint = new JSONObject();
         jConstraint.put("type", constraint.getType().name());
         switch (constraint.getType()) {
-            case value:
+            case value: //both ValueConstraint and ReferenceConstraint
                 ValueConstraint valueConstraint = ((ValueConstraint) constraint);
                 if (valueConstraint.getValue() != null) {
                     jConstraint.put("value", valueConstraint.getValue());
                 }
-                Collection<String> dataTypes = valueConstraint.getDataTypes();
-                if (dataTypes != null && !dataTypes.isEmpty()) {
-                    //in case of type = reference we do not need to add any dataTypes!
-                    jConstraint.put("dataTypes", valueConstraint.getDataTypes());
-                    //Event that internally "reference" is not part of the
-                    //ConstraintType enum it is still present in the serialisation
-                    //ant the Java API (see ReferenceConstraint class)
-                    //Value constraints with the dataType Reference and AnyURI are
-                    //considered to represent reference constraints
-                    if(dataTypes.size() == 1 && 
-                            (dataTypes.contains(DataTypeEnum.Reference.getUri()) || 
-                                    dataTypes.contains(DataTypeEnum.AnyUri.getUri()))){
-                        jConstraint.remove("type");
-                        jConstraint.put("type", "reference");
+                if(constraint instanceof ReferenceConstraint){
+                    //the type "reference" is not present in the ConstraintType
+                    //enum, because internally ReferenceConstraints are just a
+                    //ValueConstraint with a predefined data type, but "reference"
+                    //is still a valid value of the type property in JSON
+                    jConstraint.put("type", "reference");
+                } else { // valueConstraint
+                    jConstraint.put("type", constraint.getType().name());
+                    //for valueConstraints we need to add also the dataType(s)
+                    Collection<String> dataTypes = valueConstraint.getDataTypes();
+                    if (dataTypes != null && !dataTypes.isEmpty()) {
+                        if(dataTypes.size() == 1) {
+                            jConstraint.put("datatype", NamespaceEnum.getShortName(dataTypes.iterator().next()));
+                        } else {
+                            ArrayList<String> dataTypeValues = new ArrayList<String>(dataTypes.size());
+                            for(String dataType : dataTypes){
+                                dataTypeValues.add(NamespaceEnum.getShortName(dataType));
+                            }
+                            jConstraint.put("datatype", dataTypeValues);
+                        }
                     }
                 }
                 break;
             case text:
                 TextConstraint textConstraint = (TextConstraint) constraint;
-                if (textConstraint.getLanguages() != null && !textConstraint.getLanguages().isEmpty()) {
-                    jConstraint.put("languages", new JSONArray(textConstraint.getLanguages()));
+                Collection<String> languages = textConstraint.getLanguages();
+                if (languages != null && !languages.isEmpty()) {
+                    if(languages.size() == 1){
+                        jConstraint.put("language", languages.iterator().next());
+                    } else {
+                        jConstraint.put("language", new JSONArray(languages));
+                    }
                 }
                 jConstraint.put("patternType", textConstraint.getPatternType().name());
                 if (textConstraint.getTexts() != null && !textConstraint.getTexts().isEmpty()) {
@@ -115,13 +131,21 @@ final class FieldQueryToJSON {
                 break;
             case range:
                 RangeConstraint rangeConstraint = (RangeConstraint) constraint;
+                Set<DataTypeEnum> dataTypes = EnumSet.noneOf(DataTypeEnum.class);
                 if (rangeConstraint.getLowerBound() != null) {
                     jConstraint.put("lowerBound", rangeConstraint.getLowerBound());
+                    dataTypes.addAll(DataTypeEnum.getPrimaryDataTypes(
+                        rangeConstraint.getLowerBound().getClass()));
                 }
                 if (rangeConstraint.getUpperBound() != null) {
                     jConstraint.put("upperBound", rangeConstraint.getUpperBound());
+                    dataTypes.addAll(DataTypeEnum.getPrimaryDataTypes(
+                        rangeConstraint.getUpperBound().getClass()));
                 }
                 jConstraint.put("inclusive", rangeConstraint.isInclusive());
+                if(!dataTypes.isEmpty()){
+                    jConstraint.put("datatype", dataTypes.iterator().next().getShortName());
+                }
             default:
                 //unknown constraint type
                 log.warn("Unsupported Constriant Type " + constraint.getType() + " (implementing class=" + constraint.getClass() + "| toString=" + constraint + ") -> skiped");

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultListWriter.java Tue Jul 26 08:13:07 2011
@@ -40,11 +40,14 @@ import javax.ws.rs.ext.MessageBodyWriter
 import javax.ws.rs.ext.Provider;
 
 import org.apache.clerezza.rdf.core.MGraph;
+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.web.base.ContextHelper;
+import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
 import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
 import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -88,16 +91,29 @@ public class QueryResultListWriter imple
                 throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
             }
         } else { //RDF
-            /*
-             * TODO: We would need to add the query to the RDF Result.
-             *       Currently not implemented, because I do not want to create
-             *       a triple version of the query and there is not yet String
-             *       representation defined for FieldQuery
-             */
             MGraph resultGraph = QueryResultsToRDF.toRDF(resultList);
+            addFieldQuery(resultList.getQuery(),resultGraph);
             getSerializer().serialize(entityStream, resultGraph, mediaType.toString());
         }
     }
-
+    private void addFieldQuery(FieldQuery query, MGraph resultGraph) {
+        if(query == null){
+            return;
+        }
+        try {
+            JSONObject fieldQueryJson = FieldQueryToJSON.toJSON(query);
+            if(fieldQueryJson != null){
+                //add the triple with the fieldQuery
+                resultGraph.add(new TripleImpl(
+                    QueryResultsToRDF.QUERY_RESULT_LIST, 
+                    QueryResultsToRDF.FIELD_QUERY, 
+                    QueryResultsToRDF.literalFactory.createTypedLiteral(
+                        fieldQueryJson.toString())));
+            }
+        } catch (JSONException e) {
+            log.warn(String.format("Unable to serialize Fieldquery %s to JSON",
+                query),e);
+        }
+    }
 
 }

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/writers/QueryResultsToRDF.java Tue Jul 26 08:13:07 2011
@@ -18,6 +18,7 @@ package org.apache.stanbol.entityhub.jer
 
 import java.util.Iterator;
 
+import org.apache.clerezza.rdf.core.LiteralFactory;
 import org.apache.clerezza.rdf.core.MGraph;
 import org.apache.clerezza.rdf.core.Triple;
 import org.apache.clerezza.rdf.core.UriRef;
@@ -34,8 +35,23 @@ final class QueryResultsToRDF {
 
     private QueryResultsToRDF() { /* do not create instances of utility classes */}
 
-    static final UriRef queryResultList = new UriRef(RdfResourceEnum.QueryResultSet.getUri());
-    static final UriRef queryResult = new UriRef(RdfResourceEnum.queryResult.getUri());
+    /**
+     * The URI used for the query result list (static for all responses)
+     */
+    static final UriRef QUERY_RESULT_LIST = new UriRef(RdfResourceEnum.QueryResultSet.getUri());
+    /**
+     * The property used for all results
+     */
+    static final UriRef QUERY_RESULT = new UriRef(RdfResourceEnum.queryResult.getUri());
+    /**
+     * The property used for the JSON serialised FieldQuery (STANBOL-298)
+     */
+    static final UriRef FIELD_QUERY = new UriRef(RdfResourceEnum.queryResult.getUri());
+    
+    /**
+     * The LiteralFactory retrieved from {@link EntityToRDF#literalFactory}
+     */
+    static final LiteralFactory literalFactory = EntityToRDF.literalFactory;
 
     static MGraph toRDF(QueryResultList<?> resultList) {
         final MGraph resultGraph;
@@ -44,7 +60,7 @@ final class QueryResultsToRDF {
             resultGraph = new SimpleMGraph(); //create a new Graph
             for (Object result : resultList) {
                 //add a triple to each reference in the result set
-                resultGraph.add(new TripleImpl(queryResultList, queryResult, new UriRef(result.toString())));
+                resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, FIELD_QUERY, new UriRef(result.toString())));
             }
         } else {
             //first determine the type of the resultList
@@ -62,7 +78,7 @@ final class QueryResultsToRDF {
                 resultGraph = ((RdfQueryResultList) resultList).getResultGraph();
                 if (isSignType) { //if we build a ResultList for Signs, that we need to do more things
                     //first remove all triples representing results
-                    Iterator<Triple> resultTripleIt = resultGraph.filter(queryResultList, queryResult, null);
+                    Iterator<Triple> resultTripleIt = resultGraph.filter(QUERY_RESULT_LIST, FIELD_QUERY, null);
                     while (resultTripleIt.hasNext()) {
                         resultTripleIt.next();
                         resultTripleIt.remove();
@@ -72,7 +88,7 @@ final class QueryResultsToRDF {
                     for (Object result : resultList) {
                         UriRef signId = new UriRef(((Entity) result).getId());
                         EntityToRDF.addEntityTriplesToGraph(resultGraph, (Entity) result);
-                        resultGraph.add(new TripleImpl(queryResultList, queryResult, signId));
+                        resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, FIELD_QUERY, signId));
                     }
                 }
             } else { //any other implementation of the QueryResultList interface
@@ -90,7 +106,7 @@ final class QueryResultsToRDF {
                         //Note: In case of Representation this Triple points to
                         //      the representation. In case of Signs it points to
                         //      the sign.
-                        resultGraph.add(new TripleImpl(queryResultList, queryResult, resultId));
+                        resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, FIELD_QUERY, resultId));
                     }
                 }
             }

Added: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/fieldquerydocumentation.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/fieldquerydocumentation.ftl?rev=1151013&view=auto
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/fieldquerydocumentation.ftl (added)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/fieldquerydocumentation.ftl Tue Jul 26 08:13:07 2011
@@ -0,0 +1,270 @@
+<#--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<h3>FieldQuery JSON format:</h3>
+
+<p> The <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/FieldQuery.java">
+FieldQuery</a> is part of the java API defined in the  
+<code>org.apache.stanbol.entityhub.servicesapi</code> bundle<p>
+
+<h3>Main Elements</h3> 
+<ul>
+    <li><code>"selected"</code>: 
+        json array with the name of the fields selected by this query </li>
+    <li><code>"offset"</code>: 
+        the offset of the first result returned by this query </li>
+    <li><code>"limit"</code>: 
+        the maximum number of results returned </li>
+    <li><code>"constraints"</code>: 
+        json array holding all the constraints of the query </li>
+</ul>
+<h4>Example:</h4>
+<code><pre>
+{
+    "selected": [ 
+        "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label", 
+        "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type"], 
+    "offset": "0", 
+    "limit": "3", 
+    "constraints": [...]
+}
+</pre></code>
+
+<h3>FieldQuery Constraints:</h3>
+
+<p>Constraints are always applied to a field. Currently the implementation is
+limited to a single constraint/field. This is an limitation of the implementation
+and not a theoretical one.</p>
+<p>There are 4 different constraint types.</p>
+<ol>
+ <li><em>ValueConstraint:</em> Checks if the value of the field is equals to the parsed
+    value and data type</li>
+ <li><em>TextConstraint:</em> Checks if the value of the field is equals to the parsed
+    value, language. It supports also wildcard and regex searches.</li>
+ <li><em>RangeConstraint:</em> Checks if the value of the field is within the parsed range</li>
+ <li><em>ReferenceConstraint:</em> A special form of the ValueConstraint that defaults the
+    data type to references (links to other entities)</li>
+</ol>
+ 
+<p>Keys required by all Constraint types:</p>
+<ul>
+    <li><code>field</code>: the field to apply the constraint</li>
+    <li><code>type</code>: the type of the constraint. 
+        One of <code>"reference"</code>, <code>"value"</code>, 
+        <code>"text"</code> or <code>"range"</code></li>
+</ul>
+
+<h3>Reference Constraint: </h3>
+
+<p>Additional key:</p>
+<ul>
+    <li><code>value</code>: the value (usually an URI) (required) </li>
+</ul>
+
+<h4>Example:</h4>
+
+<p>Search for instances of the type Place as defined in the dbpedia ontology</p>
+
+<code><pre>
+{ 
+    "type": "reference", 
+    "field": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type", 
+    "value": "http:\/\/dbpedia.org\/ontology\/Place", 
+} 
+</pre></code>
+
+<h3>Value Constraint</h3>
+
+<p>Value Constraints are very similar to Reference Constraints however they can
+be used to check values of fields for any data type.<br>
+If no data type is defined the data type will be guessed based on the provided
+JSON type of the value. For details please see the table below.</p>
+
+<p>Additional keys:</p>
+<ul>
+    <li><code>value</code>: the value (required)</li>
+    <li><code>datatype</code>: the data type of the value as a string. Multiple
+        data types can also be parsed by using a JSON array.
+        Note that if no datatype is define, the default is guessed based on the 
+        type of the parsed value. <br>
+        Especially note that string values are mapped to "xsd:string" and not 
+        "entityhub:text" as used for natural language texts within the entityhub.
+        However users are encouraged anyway to use Text Constraints for filtering
+        based on natural languages values.</li>
+</ul> 
+
+<h4>Example:</h4>
+
+<p>Search for all entities with an altitude of 34 meter. Note that a String is
+parsed as value, but the datatype is explicitly set to 'xsd:integer'</p>
+
+<code><pre>
+{
+   "selected": [
+       "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label"],
+   "offset": "0",
+   "limit": "3",
+   "constraints": [{
+        "type": "value",
+        "value": "34",
+        "field": "http:\/\/www.w3.org\/2003\/01\/geo\/wgs84_pos#alt",
+        "datatype": "xsd:int"
+    }]
+}
+</pre></code>
+
+<p> The same can be achieved by parsing numerical 34 and not specifying the
+datatype. In this case "xsd:interger" would be guessed based on the provided
+value. Note however that this would not work for "xsd:long".</p>
+
+<code><pre>
+   {
+    "type": "value",
+    "value": 34,
+    "field": "http:\/\/www.w3.org\/2003\/01\/geo\/wgs84_pos#alt",
+    }
+</pre></code>
+
+<p>Expected Results on DBPedia.org for this query include Berlin and Baghdad 
+</p>
+
+<h3>Text Constraint</h3>
+
+<p>Additional key:</p>
+<ul>
+    <li><code>text</code>: the text to search (required). If multiple values
+        are parsed, that those values are connected by using OR.<br>
+        Parsing "Barack Obama" returns Entities that contain "Barack Obama" as
+        value for the field. Parsing ["Barack","Obama"] will return all Entities
+        that contain any of the two words. Most Sites however will boost results
+        that contain both values over such that only contain a single one. 
+    </li>
+    <li><code>language</code>: the language of the searched text as string.
+        Multiple languages can be parsed as JSON array. Parsing "" as language
+        will include values with missing language information. If no language is
+        defined values in any language will be used.</li>
+    <li><code>patternType</code>: one of "wildcard", "regex" or "none" 
+        (default is "none") </li>
+    <li><code>caseSensitive</code>: boolean (default is "false")</li>
+</ul>
+
+<h4>Example:</h4>
+
+<p>
+(1) Searches for entities with an german rdfs:label starting with "Frankf"<br>
+(2) Searches for entities that contain "Frankfurt" OR "Main" OR "Airport" in
+any language
+Typically the "Frankfurt am Main Airport" should be ranked first because it
+contains all the optional terms.
+</p>
+
+<code><pre>
+{ 
+   "type": "text", 
+   "language": "de", 
+   "patternType": "wildcard", 
+   "text": "Frankf*", 
+   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
+}
+
+{ 
+   "type": "text", 
+   "text": ["Frankfurt","Main","Airport"] 
+   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
+}, 
+</pre></code>
+<p>Expected Results on DBPedia.org for (1) include "Frankfurt am Main", 
+"Eintracht Frankfurt" and "Frankfort, Kentucky" and for (2) 
+the Airport of Frankfurt am Main, Frankfurt as well as Airport. 
+</p>
+
+<h3>Range Constraint:</h3>
+
+<p>Additional key:</p>
+<ul>
+    <li><code>lowerBound</code>: The lower bound of the range 
+        (one of lower and upper bound MUST BE defined) </li>
+    <li><code>upperBound</code>: The upper bound of the range 
+        (one of lower and upper bound MUST BE defined) </li>
+    <li><code>inclusive</code>: used for both upper and lower bound 
+        (default is "false") </li>
+</ul>
+
+<h4>Example:</h4>
+
+<p>The following Query combines two range constraints and a reference constraint
+to search for cities with more than one million inhabitants that are more than
+1000 meter above sea level.</p>
+<p>Note that the range for the population needs to parse the datatype "xsd:long"
+because otherwise the parsed value would be converted the "xsd:integer".</p>
+
+<code><pre>
+{
+   "selected": [
+       "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label",
+       "http:\/\/dbpedia.org\/ontology\/populationTotal",
+       "http:\/\/www.w3.org\/2003\/01\/geo\/wgs84_pos#alt"],
+   "offset": "0",
+   "limit": "3",
+   "constraints": [{ 
+        "type": "range", 
+        "field": "http:\/\/dbpedia.org\/ontology\/populationTotal", 
+        "lowerBound": 1000000,
+        "inclusive": true,
+        "datatype": "xsd:long"
+    },{ 
+        "type": "range", 
+        "field": "http:\/\/www.w3.org\/2003\/01\/geo\/wgs84_pos#alt", 
+        "lowerBound": 1000,
+        "inclusive": true,
+    },{ 
+        "type": "reference", 
+        "field": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type", 
+        "value": "http:\/\/dbpedia.org\/ontology\/City", 
+    }]
+}
+</pre></code>
+
+<p>Expected Results on DBPedia.org include Mexico City, Bogota and Quito. 
+</p>
+
+<p> The following query searches for persons born in 1946 </p>
+
+<code><pre>
+{
+    "selected": [
+        "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label",
+        "http:\/\/dbpedia.org\/ontology\/birthDate",
+        "http:\/\/dbpedia.org\/ontology\/deathDate"],
+    "offset": "0",
+    "limit": "3",
+    "constraints": [{ 
+        "type": "range", 
+        "field": "http:\/\/dbpedia.org\/ontology\/birthDate", 
+        "lowerBound": "1946-01-01T00:00:00.000Z",
+        "upperBound": "1946-12-31T23:59:59.999Z",
+        "inclusive": true,
+        "datatype": "xsd:dateTime"
+    },{ 
+        "type": "reference", 
+        "field": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type", 
+        "value": "http:\/\/dbpedia.org\/ontology\/Person", 
+    }]
+}
+</pre></code>
+
+<p>Expected Results on DBPedia.org include Bill Clinton, George W. Bush and
+Donald Trump.</p>

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_query.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_query.ftl?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_query.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_query.ftl Tue Jul 26 08:13:07 2011
@@ -45,164 +45,3 @@
 
 <p><em>Note</em>: "@fieldQuery.json" links to a local file that contains the parsed
     Fieldquery (see ection "FieldQuery JSON format" for examples).</p>
-
-<h4>FieldQuery JSON format:</h4>
-
-<p> The <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/FieldQuery.java">
-FieldQuery</a> is part of the java API defined in the  
-<code>org.apache.stanbol.entityhub.servicesapi</code> bundle<p>
-
-<h4>Main Elements</h4> 
-<ul>
-    <li><code>"selected"</code>: 
-        json array with the name of the fields selected by this query </li>
-    <li><code>"offset"</code>: 
-        the offset of the first result returned by this query </li>
-    <li><code>"limit"</code>: 
-        the maximum number of results returned </li>
-    <li><code>"constraints"</code>: 
-        json array holding all the constraints of the query </li>
-</ul>
-<h5>Example:</h5>
-<code><pre>
-{
-    "selected": [ 
-        "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label", 
-        "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type"], 
-    "offset": "0", 
-    "limit": "3", 
-    "constraints": [...]
-}
-</pre></code>
-
-<h4>FieldQuery Constraints:</h4>
-
-<p>Constraints are always applied to a field. Currently the implementation is
-limited to a single constraint/field. This is an limitation of the implementation
-and not a theoretical one.</p>
-<p>There are 4 different constraint types.</p>
-<ol>
- <li><em>ValueConstraint:</em> Checks if the value of the field is equals to the parsed
-    value and data type</li>
- <li><em>TextConstraint:</em> Checks if the value of the field is equals to the parsed
-    value, language. It supports also wildcard and regex searches.</li>
- <li><em>RangeConstraint:</em> Checks if the value of the field is within the parsed range</li>
- <li><em>ReferenceConstraint:</em> A special form of the ValueConstraint that defaults the
-    data type to references (links to other entities)</li>
-</ol>
- 
-<p>Keys required by all Constraint types:</p>
-<ul>
-    <li><code>field</code>: the field to apply the constraint</li>
-    <li><code>type</code>: the type of the constraint. 
-        One of <code>"reference"</code>, <code>"value"</code>, 
-        <code>"text"</code> or <code>"range"</code></li>
-</ul>
-
-<h4>Reference Constraint: </h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>value</code>: the value (usually an URI) (required) </li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>Search for instances of the type Place as defined in the dbpedia ontology</p>
-
-<code><pre>
-{ 
-    "type": "reference", 
-    "field": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type", 
-    "value": "http:\/\/dbpedia.org\/ontology\/Place", 
-} 
-</pre></code>
-
-<h4>Value Constraint</h4>
-
-<p>Additional keys:</p>
-<ul>
-    <li><code>value</code>: the value (required)</li>
-    <li><code>dataTypes</code>: json array with the data types of the value 
-        (by default the dataType is defined by the type of the parsed value)</li>
-</ul> 
-
-<h5>Example:</h5>
-
-<p>Search for entities with the rdfs:label "Paris". (Note: one could also use a
-TextConstraint for this</p>
-
-<code><pre>
-{ 
-    "type": "value", 
-    "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label", 
-    "value": "Paris", 
-} 
-</pre></code>
-
-<h4>Text Constraint</h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>text</code>: the text to search (required). If multiple values
-        are parsed, that those values are connected by using OR.<br>
-        Parsing "Barack Obama" returns Entities that contain "Barack Obama" as
-        value for the field. Parsing ["Barack","Obama"] will return all Entities
-        that contain any of the two words. Most Sites however will boost results
-        that contain both values over such that only contain a single one. 
-    </li>
-    <li><code>languages</code>: json array with the languages to search 
-        (default is all languages) </li>
-    <li><code>patternType</code>: one of "wildcard", "regex" or "none" 
-        (default is "none") </li>
-    <li><code>caseSensitive</code>: boolean (default is "false")</li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>
-(1) Searches for entities with an german rdfs:label starting with "Frankf"<br>
-(2) Searches for entities that contain "Frankfurt" OR "Main" OR "Airport".
-Typically the "Frankfurt am Main Airport" should be ranked first because it
-contains all the optional terms.
-</p>
-<code><pre>
-{ 
-   "type": "text", 
-   "languages": ["de"], 
-   "patternType": "wildcard", 
-   "text": "Frankf*", 
-   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
-}, 
-{ 
-   "type": "text", 
-   "text": ["Frankfurt","Main","Airport"] 
-   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
-}, 
-</pre></code>
-
-<h4>Range Constraint: </h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>lowerBound</code>: The lower bound of the range 
-        (one of lower and upper bound MUST BE defined) </li>
-    <li><code>upperBound</code>: The upper bound of the range 
-        (one of lower and upper bound MUST BE defined) </li>
-    <li><code>inclusive</code>: used for both upper and lower bound 
-        (default is "false") </li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>Searches for entities with a population over 1 million. Note that the data type
-is automatically detected based on the parsed value (integer in that case)</p>
-
-<code><pre>
-{ 
-    "type": "range", 
-    "field": "http:\/\/dbpedia.org\/ontology\/populationTotal", 
-    "lowerBound": 1000000, 
-    "inclusive": true, 
-}
-</pre></code>

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/query.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/query.ftl?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/query.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/query.ftl Tue Jul 26 08:13:07 2011
@@ -19,6 +19,8 @@
 <@common.page title="Entityhub Query" hasrestapi=false> 
 
 <#include "inc_query.ftl">
+<hr>
+<#include "/imports/fieldquerydocumentation.ftl">
 
 </...@common.page>
 </#escape>

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_query.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_query.ftl?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_query.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_query.ftl Tue Jul 26 08:13:07 2011
@@ -45,164 +45,3 @@
 
 <p><em>Note</em>: "@fieldQuery.json" links to a local file that contains the parsed
     Fieldquery (see ection "FieldQuery JSON format" for examples).</p>
-
-<h4>FieldQuery JSON format:</h4>
-
-<p> The <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/FieldQuery.java">
-FieldQuery</a> is part of the java API defined in the  
-<code>org.apache.stanbol.entityhub.servicesapi</code> bundle<p>
-
-<h4>Main Elements</h4> 
-<ul>
-    <li><code>"selected"</code>: 
-        json array with the name of the fields selected by this query </li>
-    <li><code>"offset"</code>: 
-        the offset of the first result returned by this query </li>
-    <li><code>"limit"</code>: 
-        the maximum number of results returned </li>
-    <li><code>"constraints"</code>: 
-        json array holding all the constraints of the query </li>
-</ul>
-<h5>Example:</h5>
-<code><pre>
-{
-    "selected": [ 
-        "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label", 
-        "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type"], 
-    "offset": "0", 
-    "limit": "3", 
-    "constraints": [...]
-}
-</pre></code>
-
-<h4>FieldQuery Constraints:</h4>
-
-<p>Constraints are always applied to a field. Currently the implementation is
-limited to a single constraint/field. This is an limitation of the implementation
-and not a theoretical one.</p>
-<p>There are 4 different constraint types.</p>
-<ol>
- <li><em>ValueConstraint:</em> Checks if the value of the field is equals to the parsed
-    value and data type</li>
- <li><em>TextConstraint:</em> Checks if the value of the field is equals to the parsed
-    value, language. It supports also wildcard and regex searches.</li>
- <li><em>RangeConstraint:</em> Checks if the value of the field is within the parsed range</li>
- <li><em>ReferenceConstraint:</em> A special form of the ValueConstraint that defaults the
-    data type to references (links to other entities)</li>
-</ol>
- 
-<p>Keys required by all Constraint types:</p>
-<ul>
-    <li><code>field</code>: the field to apply the constraint</li>
-    <li><code>type</code>: the type of the constraint. 
-        One of <code>"reference"</code>, <code>"value"</code>, 
-        <code>"text"</code> or <code>"range"</code></li>
-</ul>
-
-<h4>Reference Constraint: </h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>value</code>: the value (usually an URI) (required) </li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>Search for instances of the type Place as defined in the dbpedia ontology</p>
-
-<code><pre>
-{ 
-    "type": "reference", 
-    "field": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type", 
-    "value": "http:\/\/dbpedia.org\/ontology\/Place", 
-} 
-</pre></code>
-
-<h4>Value Constraint</h4>
-
-<p>Additional keys:</p>
-<ul>
-    <li><code>value</code>: the value (required)</li>
-    <li><code>dataTypes</code>: json array with the data types of the value 
-        (by default the dataType is defined by the type of the parsed value)</li>
-</ul> 
-
-<h5>Example:</h5>
-
-<p>Search for entities with the rdfs:label "Paris". (Note: one could also use a
-TextConstraint for this</p>
-
-<code><pre>
-{ 
-    "type": "value", 
-    "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label", 
-    "value": "Paris", 
-} 
-</pre></code>
-
-<h4>Text Constraint</h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>text</code>: the text to search (required). If multiple values
-        are parsed, that those values are connected by using OR.<br>
-        Parsing "Barack Obama" returns Entities that contain "Barack Obama" as
-        value for the field. Parsing ["Barack","Obama"] will return all Entities
-        that contain any of the two words. Most Sites however will boost results
-        that contain both values over such that only contain a single one. 
-    </li>
-    <li><code>languages</code>: json array with the languages to search 
-        (default is all languages) </li>
-    <li><code>patternType</code>: one of "wildcard", "regex" or "none" 
-        (default is "none") </li>
-    <li><code>caseSensitive</code>: boolean (default is "false")</li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>
-(1) Searches for entities with an german rdfs:label starting with "Frankf"<br>
-(2) Searches for entities that contain "Frankfurt" OR "Main" OR "Airport".
-Typically the "Frankfurt am Main Airport" should be ranked first because it
-contains all the optional terms.
-</p>
-<code><pre>
-{ 
-   "type": "text", 
-   "languages": ["de"], 
-   "patternType": "wildcard", 
-   "text": "Frankf*", 
-   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
-}, 
-{ 
-   "type": "text", 
-   "text": ["Frankfurt","Main","Airport"] 
-   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
-}, 
-</pre></code>
-
-<h4>Range Constraint: </h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>lowerBound</code>: The lower bound of the range 
-        (one of lower and upper bound MUST BE defined) </li>
-    <li><code>upperBound</code>: The upper bound of the range 
-        (one of lower and upper bound MUST BE defined) </li>
-    <li><code>inclusive</code>: used for both upper and lower bound 
-        (default is "false") </li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>Searches for entities with a population over 1 million. Note that the data type
-is automatically detected based on the parsed value (integer in that case)</p>
-
-<code><pre>
-{ 
-    "type": "range", 
-    "field": "http:\/\/dbpedia.org\/ontology\/populationTotal", 
-    "lowerBound": 1000000, 
-    "inclusive": true, 
-}
-</pre></code>
\ No newline at end of file

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/query.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/query.ftl?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/query.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/query.ftl Tue Jul 26 08:13:07 2011
@@ -19,6 +19,8 @@
 <@common.page> 
 
 <#include "inc_query.ftl">
+<hr>
+<#include "/imports/fieldquerydocumentation.ftl">
 
 </...@common.page>
 </#escape>

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_query.ftl Tue Jul 26 08:13:07 2011
@@ -46,164 +46,4 @@
 <p><em>Note</em>: "@fieldQuery.json" links to a local file that contains the parsed
     Fieldquery (see ection "FieldQuery JSON format" for examples).</p>
 
-<h4>FieldQuery JSON format:</h4>
-
-<p> The <a href="http://svn.apache.org/repos/asf/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/query/FieldQuery.java">
-FieldQuery</a> is part of the java API defined in the  
-<code>org.apache.stanbol.entityhub.servicesapi</code> bundle<p>
-
-<h4>Main Elements</h4> 
-<ul>
-    <li><code>"selected"</code>: 
-        json array with the name of the fields selected by this query </li>
-    <li><code>"offset"</code>: 
-        the offset of the first result returned by this query </li>
-    <li><code>"limit"</code>: 
-        the maximum number of results returned </li>
-    <li><code>"constraints"</code>: 
-        json array holding all the constraints of the query </li>
-</ul>
-<h5>Example:</h5>
-<code><pre>
-{
-    "selected": [ 
-        "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label", 
-        "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type"], 
-    "offset": "0", 
-    "limit": "3", 
-    "constraints": [...]
-}
-</pre></code>
-
-<h4>FieldQuery Constraints:</h4>
-
-<p>Constraints are always applied to a field. Currently the implementation is
-limited to a single constraint/field. This is an limitation of the implementation
-and not a theoretical one.</p>
-<p>There are 4 different constraint types.</p>
-<ol>
- <li><em>ValueConstraint:</em> Checks if the value of the field is equals to the parsed
-    value and data type</li>
- <li><em>TextConstraint:</em> Checks if the value of the field is equals to the parsed
-    value, language. It supports also wildcard and regex searches.</li>
- <li><em>RangeConstraint:</em> Checks if the value of the field is within the parsed range</li>
- <li><em>ReferenceConstraint:</em> A special form of the ValueConstraint that defaults the
-    data type to references (links to other entities)</li>
-</ol>
- 
-<p>Keys required by all Constraint types:</p>
-<ul>
-    <li><code>field</code>: the field to apply the constraint</li>
-    <li><code>type</code>: the type of the constraint. 
-        One of <code>"reference"</code>, <code>"value"</code>, 
-        <code>"text"</code> or <code>"range"</code></li>
-</ul>
-
-<h4>Reference Constraint: </h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>value</code>: the value (usually an URI) (required) </li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>Search for instances of the type Place as defined in the dbpedia ontology</p>
-
-<code><pre>
-{ 
-    "type": "reference", 
-    "field": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type", 
-    "value": "http:\/\/dbpedia.org\/ontology\/Place", 
-} 
-</pre></code>
-
-<h4>Value Constraint</h4>
-
-<p>Additional keys:</p>
-<ul>
-    <li><code>value</code>: the value (required)</li>
-    <li><code>dataTypes</code>: json array with the data types of the value 
-        (by default the dataType is defined by the type of the parsed value)</li>
-</ul> 
-
-<h5>Example:</h5>
-
-<p>Search for entities with the rdfs:label "Paris". (Note: one could also use a
-TextConstraint for this</p>
-
-<code><pre>
-{ 
-    "type": "value", 
-    "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label", 
-    "value": "Paris", 
-} 
-</pre></code>
-
-<h4>Text Constraint</h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>text</code>: the text to search (required). If multiple values
-        are parsed, that those values are connected by using OR.<br>
-        Parsing "Barack Obama" returns Entities that contain "Barack Obama" as
-        value for the field. Parsing ["Barack","Obama"] will return all Entities
-        that contain any of the two words. Most Sites however will boost results
-        that contain both values over such that only contain a single one. 
-    </li>
-    <li><code>languages</code>: json array with the languages to search 
-        (default is all languages) </li>
-    <li><code>patternType</code>: one of "wildcard", "regex" or "none" 
-        (default is "none") </li>
-    <li><code>caseSensitive</code>: boolean (default is "false")</li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>
-(1) Searches for entities with an german rdfs:label starting with "Frankf"<br>
-(2) Searches for entities that contain "Frankfurt" OR "Main" OR "Airport".
-Typically the "Frankfurt am Main Airport" should be ranked first because it
-contains all the optional terms.
-</p>
-
-<code><pre>
-{ 
-   "type": "text", 
-   "languages": ["de"], 
-   "patternType": "wildcard", 
-   "text": "Frankf*", 
-   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
-}, 
-{ 
-   "type": "text", 
-   "text": ["Frankfurt","Main","Airport"] 
-   "field": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#label" 
-}, 
-</pre></code>
-
-<h4>Range Constraint: </h4>
-
-<p>Additional key:</p>
-<ul>
-    <li><code>lowerBound</code>: The lower bound of the range 
-        (one of lower and upper bound MUST BE defined) </li>
-    <li><code>upperBound</code>: The upper bound of the range 
-        (one of lower and upper bound MUST BE defined) </li>
-    <li><code>inclusive</code>: used for both upper and lower bound 
-        (default is "false") </li>
-</ul>
-
-<h5>Example:</h5>
-
-<p>Searches for entities with a population over 1 million. Note that the data type
-is automatically detected based on the parsed value (integer in that case)</p>
-
-<code><pre>
-{ 
-    "type": "range", 
-    "field": "http:\/\/dbpedia.org\/ontology\/populationTotal", 
-    "lowerBound": 1000000, 
-    "inclusive": true, 
-}
-</pre></code>
\ No newline at end of file
+    
\ No newline at end of file

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/query.ftl Tue Jul 26 08:13:07 2011
@@ -19,6 +19,7 @@
 <@common.page> 
 
 <#include "inc_query.ftl">
-
+<hr>
+<#include "/imports/fieldquerydocumentation.ftl">
 </...@common.page>
 </#escape>

Modified: incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/launchers/full/src/main/bundles/list.xml Tue Jul 26 08:13:07 2011
@@ -401,7 +401,7 @@
     <bundle>
       <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.data.sites.dbpedia.default</artifactId>
-      <version>1.0.0-incubating</version>
+      <version>1.0.1-incubating</version>
     </bundle>
   </startLevel>
 

Modified: incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/launchers/kres/src/main/bundles/list.xml Tue Jul 26 08:13:07 2011
@@ -442,7 +442,7 @@
 	    <bundle>
 	        <groupId>org.apache.stanbol</groupId>
 	        <artifactId>org.apache.stanbol.data.sites.dbpedia.default</artifactId>
-	        <version>1.0.0-incubating</version>
+	        <version>1.0.1-incubating</version>
 	    </bundle>
 		<bundle>
 			<groupId>org.apache.stanbol</groupId>

Modified: incubator/stanbol/trunk/launchers/stable/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/stable/src/main/bundles/list.xml?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/launchers/stable/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/launchers/stable/src/main/bundles/list.xml Tue Jul 26 08:13:07 2011
@@ -391,7 +391,7 @@
     <bundle>
       <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.data.sites.dbpedia.default</artifactId>
-      <version>1.0.0-incubating</version>
+      <version>1.0.1-incubating</version>
     </bundle>
   </startLevel>
 

Modified: incubator/stanbol/trunk/launchers/stateless/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/launchers/stateless/src/main/bundles/list.xml?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/launchers/stateless/src/main/bundles/list.xml (original)
+++ incubator/stanbol/trunk/launchers/stateless/src/main/bundles/list.xml Tue Jul 26 08:13:07 2011
@@ -373,7 +373,7 @@
     <bundle>
       <groupId>org.apache.stanbol</groupId>
       <artifactId>org.apache.stanbol.data.sites.dbpedia.default</artifactId>
-      <version>1.0.0-incubating</version>
+      <version>1.0.1-incubating</version>
     </bundle>
   </startLevel>
 

Modified: incubator/stanbol/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/parent/pom.xml?rev=1151013&r1=1151012&r2=1151013&view=diff
==============================================================================
--- incubator/stanbol/trunk/parent/pom.xml (original)
+++ incubator/stanbol/trunk/parent/pom.xml Tue Jul 26 08:13:07 2011
@@ -313,7 +313,7 @@
       <dependency>
         <groupId>org.apache.stanbol</groupId>
         <artifactId>org.apache.stanbol.data.sites.dbpedia.default</artifactId>
-        <version>1.0.0-incubating</version>
+        <version>1.0.1-incubating</version>
         <scope>provided</scope>
       </dependency>