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/12/16 13:23:36 UTC

svn commit: r1215109 - in /incubator/stanbol/trunk/entityhub: generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/ jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/ jersey/src/main/java/org/apache/stanbol/...

Author: rwesten
Date: Fri Dec 16 12:23:35 2011
New Revision: 1215109

URL: http://svn.apache.org/viewvc?rev=1215109&view=rev
Log:
STANBOL-408: LD Path improvements

* The new Configuration feature of LD Path is now used to set the default namespaces of the Entityhub
* updated LD Path short docu to reflect the default namespaces
* adapted the example to use the default namespaces
* added a "simple reasoning" example to the /ldpath endpoints

other:

 * corrected a bug in the RDF serialization of QueryResultList. The executed query was attached to the QueryResultSet by using the wrong rdf property.

Modified:
    incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java
    incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.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/imports/ldpathdocumentation.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_find.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_ldpath.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_find.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_ldpath.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl
    incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_ldpath.ftl
    incubator/stanbol/trunk/entityhub/ldpath/src/main/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPath.java
    incubator/stanbol/trunk/entityhub/ldpath/src/test/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPathTest.java

Modified: incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java (original)
+++ incubator/stanbol/trunk/entityhub/generic/servicesapi/src/main/java/org/apache/stanbol/entityhub/servicesapi/model/rdf/RdfResourceEnum.java Fri Dec 16 12:23:35 2011
@@ -154,6 +154,11 @@ public enum RdfResourceEnum {
      */
     queryResult(NamespaceEnum.entityhubQuery),
     /**
+     * Property used to link the Literal with the executed Query to the
+     * {@link #QueryResultSet}
+     */
+    query(NamespaceEnum.entityhubQuery),
+    /**
      * The score of the result in respect to the parsed query.
      */
     resultScore(NamespaceEnum.entityhubQuery,"score"),

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java Fri Dec 16 12:23:35 2011
@@ -1,6 +1,6 @@
 package org.apache.stanbol.entityhub.jersey.utils;
 
-import static javax.ws.rs.core.MediaType.TEXT_HTML;
+import static javax.ws.rs.core.MediaType.*;
 import static org.apache.stanbol.commons.web.base.CorsHelper.addCORSOrigin;
 import static org.apache.stanbol.entityhub.jersey.utils.LDPathHelper.RESULT_SCORE_MAPPING;
 import static org.apache.stanbol.entityhub.ldpath.LDPathUtils.getReader;
@@ -163,6 +163,11 @@ public class LDPathHelper {
             rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML+"; charset=utf-8");
             addCORSOrigin(servletContext, rb, headers);
             return rb.build();
+        } else if(acceptedMediaType.equals(TEXT_HTML_TYPE)){
+            //HTML is only supported for documentation
+            return Response.status(Status.NOT_ACCEPTABLE)
+            .entity("The requested content type "+TEXT_HTML+" is not supported.\n")
+            .header(HttpHeaders.ACCEPT, acceptedMediaType).build();
         }
         MGraph data;
         try {

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=1215109&r1=1215108&r2=1215109&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 Fri Dec 16 12:23:35 2011
@@ -46,7 +46,7 @@ final class QueryResultsToRDF {
     /**
      * The property used for the JSON serialised FieldQuery (STANBOL-298)
      */
-    static final UriRef FIELD_QUERY = new UriRef(RdfResourceEnum.queryResult.getUri());
+    static final UriRef FIELD_QUERY = new UriRef(RdfResourceEnum.query.getUri());
     
     /**
      * The LiteralFactory retrieved from {@link EntityToRDF#literalFactory}
@@ -60,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(QUERY_RESULT_LIST, FIELD_QUERY, new UriRef(result.toString())));
+                resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, QUERY_RESULT, new UriRef(result.toString())));
             }
         } else {
             //first determine the type of the resultList
@@ -78,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(QUERY_RESULT_LIST, FIELD_QUERY, null);
+                    Iterator<Triple> resultTripleIt = resultGraph.filter(QUERY_RESULT_LIST, QUERY_RESULT, null);
                     while (resultTripleIt.hasNext()) {
                         resultTripleIt.next();
                         resultTripleIt.remove();
@@ -88,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(QUERY_RESULT_LIST, FIELD_QUERY, signId));
+                        resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, QUERY_RESULT, signId));
                     }
                 }
             } else { //any other implementation of the QueryResultList interface
@@ -106,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(QUERY_RESULT_LIST, FIELD_QUERY, resultId));
+                        resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, QUERY_RESULT, resultId));
                     }
                 }
             }

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/ldpathdocumentation.ftl
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/ldpathdocumentation.ftl?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/ldpathdocumentation.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/imports/ldpathdocumentation.ftl Fri Dec 16 12:23:35 2011
@@ -44,6 +44,46 @@ documentation</a> is also available on t
 <pre><code>@prefix foaf : &lt;http://xmlns.com/foaf/0.1/&gt;;
 </code></pre>
 
+<p><em>Predefined Namespaces:</em></p>
+<ul>
+<li><strong>entityhub</strong>: http://www.iks-project.eu/ontology/rick/model/</li>
+<li><strong>entityhub-query</strong>: http://www.iks-project.eu/ontology/rick/query/</li>
+<li><strong>xsd</strong>: http://www.w3.org/2001/XMLSchema#</li>
+<li><strong>xsi</strong>: http://www.w3.org/2001/XMLSchema-instance#</li>
+<li><strong>xml</strong>: http://www.w3.org/XML/1998/namespace#</li>
+<li><strong>rdf</strong>: http://www.w3.org/1999/02/22-rdf-syntax-ns#</li>
+<li><strong>rdfs</strong>: http://www.w3.org/2000/01/rdf-schema#</li>
+<li><strong>owl</strong>: http://www.w3.org/2002/07/owl#</li>
+<li><strong>atom</strong>: http://www.w3.org/2005/Atom</li>
+<li><strong>cmis</strong>: http://docs.oasis-open.org/ns/cmis/core/200908/</li>
+<li><strong>cmis-ra</strong>: http://docs.oasis-open.org/ns/cmis/restatom/200908/</li>
+<li><strong>jcr</strong>: http://www.jcp.org/jcr/1.0/</li>
+<li><strong>jcr-sv</strong>: http://www.jcp.org/jcr/sv/1.0/</li>
+<li><strong>jcr-nt</strong>: http://www.jcp.org/jcr/nt/1.0/</li>
+<li><strong>jcr-mix</strong>: http://www.jcp.org/jcr/mix/1.0/</li>
+<li><strong>geo</strong>: http://www.w3.org/2003/01/geo/wgs84_pos#</li>
+<li><strong>georss</strong>: http://www.georss.org/georss/</li>
+<li><strong>gml</strong>: http://www.opengis.net/gml/</li>
+<li><strong>dc-elements</strong>: http://purl.org/dc/elements/1.1/</li>
+<li><strong>dc</strong>: http://purl.org/dc/terms/</li>
+<li><strong>foaf</strong>: http://xmlns.com/foaf/0.1/</li>
+<li><strong>vCal</strong>: http://www.w3.org/2002/12/cal#</li>
+<li><strong>vCard</strong>: http://www.w3.org/2001/vcard-rdf/3.0#</li>
+<li><strong>skos</strong>: http://www.w3.org/2004/02/skos/core#</li>
+<li><strong>sioc</strong>: http://rdfs.org/sioc/ns#</li>
+<li><strong>sioc-types</strong>: http://rdfs.org/sioc/types#</li>
+<li><strong>dc-bio</strong>: http://purl.org/vocab/bio/0.1/</li>
+<li><strong>rss</strong>: http://purl.org/rss/1.0/</li>
+<li><strong>gr</strong>: http://purl.org/goodrelations/v1#</li>
+<li><strong>swrc</strong>: http://swrc.ontoware.org/ontology#</li>
+<li><strong>dbp-ont</strong>: http://dbpedia.org/ontology/</li>
+<li><strong>dbp-prop</strong>: http://dbpedia.org/property/</li>
+<li><strong>geonames</strong>: http://www.geonames.org/ontology#</li>
+<li><strong>cc</strong>: http://creativecommons.org/ns#</li>
+<li><strong>schema</strong>: http://schema.org/</li>
+</ul>
+
+
 <h3>Field Definitions</h3>
 
 <p>Define fields in the search index to map to path definitions.</p>
@@ -108,6 +148,9 @@ title = &lt;http://xmlns.com/foaf/0.1/na
 <pre><code>topic_interests = foaf:interest &amp; foaf:topic</em>interest :: xsd:anyURI;
 </code></pre></li>
 <li><p>Recursive Selections ((PATH)+)</p>
+<pre><code>skos:broaderTransitive = (skos:broader | ^skos:narrower)+;
+</code></pre></li>
+
 <li><p>Tests ([...]): filter the collection based on test criteria</p>
 
 <ul><li>Path Existence Test (PATH): only resources where a subpath yields some value</li>
@@ -131,6 +174,7 @@ fluidfood = foaf:interest[rdf:type is ex
 <li><p>Combinations of Tests</p>
 
 <pre><code>foodstuff = foaf:interest[rdf:type is ex:Food]/rdfs:label[@es] :: xsd:string ;
+relatedPersons = (* | dc:subject/^dc:subject)[rdf:type is dbp-ont:Person]/rdfs:label[@en] :: xsd:string;
 </code></pre></li>
 </ul>
 <li><p>Functions (f(...)): apply a function on the values of the selections passed as argument</p>

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_find.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_find.ftl?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_find.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_find.ftl Fri Dec 16 12:23:35 2011
@@ -82,11 +82,9 @@ with 'Pari'.</p>
       (optional, number, default: 0) The offset of the first returned result</td>
   </tr><tr>
     <td><strong>LDPath:</strong>
-    </td><td><textarea class="input" name="ldpath" rows="10">@prefix dct : <http://purl.org/dc/terms/> ;
-@prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;
-name = rdfs:label[@en] :: xsd:string;
+    </td><td><textarea class="input" name="ldpath" rows="10">name = rdfs:label[@en] :: xsd:string;
 comment = rdfs:comment[@en] :: xsd:string;
-categories = dct:subject :: xsd:anyURI;
+categories = dc:subject :: xsd:anyURI;
 homepage = foaf:homepage :: xsd:anyURI;
 location = fn:concat("[",geo:lat,",",geo:long,"]") :: xsd:string;</textarea><br>
       (optional). LDPath programs can be used to specify what information to return for

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_ldpath.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_ldpath.ftl?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_ldpath.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource/inc_ldpath.ftl Fri Dec 16 12:23:35 2011
@@ -61,7 +61,7 @@
 
 <p>Execute the LDPath on the Context:<br>
 <form name="ldpathExample" id="ldpathExample">
-    <strong>Context:</strong> <input type="text" size="120" name="context" value="http://dbpedia.org/resource/Paris">
+    <strong>Context:</strong> <input type="text" size="120" name="context" value="http://dbpedia.org/resource/Paris"><br>
     <strong>LD-Path:</strong><br>
     <textarea class="input" name="ldpath" rows="10">@prefix dct : <http://purl.org/dc/terms/> ;
 @prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_find.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_find.ftl?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_find.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_find.ftl Fri Dec 16 12:23:35 2011
@@ -83,11 +83,9 @@
       (optional, number, default: 0) The offset of the first returned result</td>
   </tr><tr>
     <td><strong>LDPath:</strong>
-    </td><td><textarea class="input" name="ldpath" rows="10">@prefix dct : <http://purl.org/dc/terms/> ;
-@prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;
-name = rdfs:label[@en] :: xsd:string;
+    </td><td><textarea class="input" name="ldpath" rows="10">name = rdfs:label[@en] :: xsd:string;
 comment = rdfs:comment[@en] :: xsd:string;
-categories = dct:subject :: xsd:anyURI;
+categories = dc:subject :: xsd:anyURI;
 homepage = foaf:homepage :: xsd:anyURI;
 location = fn:concat("[",geo:lat,",",geo:long,"]") :: xsd:string;</textarea><br>
       (optional). LDPath programs can be used to specify what information to return for

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_ldpath.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_ldpath.ftl?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_ldpath.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource/inc_ldpath.ftl Fri Dec 16 12:23:35 2011
@@ -33,7 +33,8 @@
 	</tr>
 	<tr>
 		<th>Parameter</th>
-		<td><ul><li>ldpath: The LDPath program to execute.</li>
+		<td><ul><li>ldpath: The LDPath program to execute. For a detailed description 
+		          of the language see the end of this page.</li>
     			<li>context: The id of the entity used as context for the execution
     			of the LDPath program. This parameter can occur multiple times</li>
     		</ul>
@@ -62,15 +63,13 @@
 
 <p>Execute the LDPath on the Context:<br>
 <form name="ldpathExample" id="ldpathExample">
-	<strong>Context:</strong> <input type="text" size="120" name="context" value="http://dbpedia.org/resource/Paris">
+	<strong>Context:</strong> <input type="text" size="120" name="context" value="http://dbpedia.org/resource/Paris"><br>
 	<strong>LD-Path:</strong><br>
-	<textarea class="input" name="ldpath" rows="10">@prefix dct : <http://purl.org/dc/terms/> ;
-@prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;
-name = rdfs:label[@en] :: xsd:string;
-labels = rdfs:label :: xsd:string;
-comment = rdfs:comment[@en] :: xsd:string;
-categories = dct:subject :: xsd:anyURI;
-homepage = foaf:homepage :: xsd:anyURI;
+	<textarea class="input" name="ldpath" rows="10">schema:name = rdfs:label[@en];
+rdfs:label;
+schema:description = rdfs:comment[@en];
+categories = dc:subject :: xsd:anyURI;
+schema:url = foaf:homepage :: xsd:anyURI;
 location = fn:concat("[",geo:lat,",",geo:long,"]") :: xsd:string;</textarea><br>
 <strong>Format:</strong> <select name="format" id="findOutputFormat">
         <option value="application/json">JSON-LD</option>
@@ -119,22 +118,42 @@ function executeLDPath() {
 <p><strong>Other LDPath Examples:</strong><ul>
 <li> This select all persons a) directly connected b) member of the same category c)
 member of a (direct) sub-category:
-      <textarea rows="5" readonly>@prefix dct : <http://purl.org/dc/terms/> ;
-@prefix dbp-ont : <http://dbpedia.org/ontology/> ;
-@prefix skos : <http://www.w3.org/2004/02/skos/core#> ;
-name = rdfs:label[@en] :: xsd:string ;
-people = (* | dct:subject/^dct:subject | dct:subject/^skos:broader/^dct:subject)[rdf:type is dbp-ont:Person] :: xsd:anyURI;</textarea>
+      <textarea rows="2" readonly>schema:name = rdfs:label[@en] :: xsd:string ;
+people = (* | dc:subject/^dc:subject | dc:subject/^skos:broader/^dc:subject)[rdf:type is dbp-ont:Person] :: xsd:anyURI;</textarea>
 <li> Schema translation: The following example converts dbpedia data for to schema.org
-      <textarea rows="5" readonly>@prefix dct : <http://purl.org/dc/terms/> ;
-@prefix dbp-ont : <http://dbpedia.org/ontology/> ;
-@prefix skos : <http://www.w3.org/2004/02/skos/core#> ;
-@prefix schema : <http://schema.org/> ;
-@prefix foaf : <http://xmlns.com/foaf/0.1/> ;
-schema:name = rdfs:label[@en];
+      <textarea rows="6" readonly>schema:name = rdfs:label[@en];
 schema:description = rdfs:comment[@en];
 schema:image = foaf:depiction;
 schema:url = foaf:homepage;
 schema:birthDate = dbp-ont:birthDate;
 schema:deathDate = dbp-ont:deathDate;</textarea>
+<li> Simple reasoning: The following shows an example how LD Path can be used to
+for deduce additional knowledge for a given context.<br>
+In this case sub-property, inverse- and transitive relations as defined by the
+SKOS ontology are expressed in LD Path.<br>
+NOTE: the rule for 'skos:narrowerTransitive' will not scale in big Thesaurus (e.g. 
+for the root node it will return every concept in the Thesaurus).
+In contrast the 'skos:broaderTransitive' rule is ok even for big Thesaurus as 
+long as they are not cyclic (such as the DBPedia Categories).<br>
+<textarea rows="10" readonly>skos:prefLabel;
+skos:altLabel;
+skos:hiddenLabel;
+rdfs:label = (skos:prefLabel | skos:altLabel | skos:hiddenLabel);
+skos:notation
+
+skos:inScheme;
+
+skos:broader = (skos:broader | ^skos:narrower);
+skos:broaderTransitive = (skos:broader | ^skos:narrower)+;
+
+skos:narrower = (^skos:broader | skos:narrower);
+skos:narrowerTransitive = (^skos:broader | skos:narrower)+;
+
+skos:related = (skos:related | skos:relatedMatch);
+skos:relatedMatch;
+skos:exactMatch = (skos:exactMatch)+;
+skos:closeMatch = (skos:closeMatch | (skos:exactMatch)+);
+skos:broaderMatch = (^skos:narrowMatch | skos:broaderMatch);
+skos:narrowMatch = (skos:narrowMatch | ^skos:broaderMatch);</textarea>
 </ul>
 </p>
\ 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/inc_find.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_find.ftl?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_find.ftl Fri Dec 16 12:23:35 2011
@@ -81,9 +81,7 @@
       (optional, number, default: 0) The offset of the first returned result</td>
   </tr><tr>
     <td><strong>LDPath:</strong>
-    </td><td><textarea class="input" name="ldpath" rows="10">@prefix dct : <http://purl.org/dc/terms/> ;
-@prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;
-name = rdfs:label[@en] :: xsd:string;
+    </td><td><textarea class="input" name="ldpath" rows="10">name = rdfs:label[@en] :: xsd:string;
 comment = rdfs:comment[@en] :: xsd:string;
 categories = dct:subject :: xsd:anyURI;
 homepage = foaf:homepage :: xsd:anyURI;

Modified: incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_ldpath.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_ldpath.ftl?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_ldpath.ftl (original)
+++ incubator/stanbol/trunk/entityhub/jersey/src/main/resources/org/apache/stanbol/entityhub/jersey/templates/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource/inc_ldpath.ftl Fri Dec 16 12:23:35 2011
@@ -61,7 +61,7 @@
 
 <p>Execute the LDPath on the Context:<br>
 <form name="ldpathExample" id="ldpathExample">
-    <strong>Context:</strong> <input type="text" size="120" name="context" value="http://dbpedia.org/resource/Paris">
+    <strong>Context:</strong> <input type="text" size="120" name="context" value="http://dbpedia.org/resource/Paris"><br>
     <strong>LD-Path:</strong><br>
     <textarea class="input" name="ldpath" rows="10">@prefix dct : <http://purl.org/dc/terms/> ;
 @prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;
@@ -129,5 +129,32 @@ schema:image = foaf:depiction;
 schema:url = foaf:homepage;
 schema:birthDate = dbp-ont:birthDate;
 schema:deathDate = dbp-ont:deathDate;</textarea>
-</ul>
+<li> Simple reasoning: The following shows an example how LD Path can be used to
+for deduce additional knowledge for a given context.<br>
+In this case sub-property, inverse- and transitive relations as defined by the
+SKOS ontology are expressed in LD Path.<br>
+NOTE: the rule for 'skos:narrowerTransitive' will not scale in big Thesaurus (e.g. 
+for the root node it will return every concept in the Thesaurus).
+In contrast the 'skos:broaderTransitive' rule is ok even for big Thesaurus as 
+long as they are not cyclic (such as the DBPedia Categories).<br>
+<textarea rows="10" readonly>skos:prefLabel;
+skos:altLabel;
+skos:hiddenLabel;
+rdfs:label = (skos:prefLabel | skos:altLabel | skos:hiddenLabel);
+skos:notation
+
+skos:inScheme;
+
+skos:broader = (skos:broader | ^skos:narrower);
+skos:broaderTransitive = (skos:broader | ^skos:narrower)+;
+
+skos:narrower = (^skos:broader | skos:narrower);
+skos:narrowerTransitive = (^skos:broader | skos:narrower)+;
+
+skos:related = (skos:related | skos:relatedMatch);
+skos:relatedMatch;
+skos:exactMatch = (skos:exactMatch)+;
+skos:closeMatch = (skos:closeMatch | (skos:exactMatch)+);
+skos:broaderMatch = (^skos:narrowMatch | skos:broaderMatch);
+skos:narrowMatch = (skos:narrowMatch | ^skos:broaderMatch);</textarea></ul>
 </p>

Modified: incubator/stanbol/trunk/entityhub/ldpath/src/main/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPath.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/ldpath/src/main/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPath.java?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/ldpath/src/main/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPath.java (original)
+++ incubator/stanbol/trunk/entityhub/ldpath/src/main/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPath.java Fri Dec 16 12:23:35 2011
@@ -7,6 +7,7 @@ import org.apache.stanbol.entityhub.core
 import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
 import org.apache.stanbol.entityhub.ldpath.transformer.ValueConverterTransformerAdapter;
 import org.apache.stanbol.entityhub.servicesapi.defaults.DataTypeEnum;
+import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
 import org.apache.stanbol.entityhub.servicesapi.model.Reference;
 import org.apache.stanbol.entityhub.servicesapi.model.Representation;
 import org.apache.stanbol.entityhub.servicesapi.model.Text;
@@ -17,6 +18,8 @@ import at.newmedialab.ldpath.api.backend
 import at.newmedialab.ldpath.api.transformers.NodeTransformer;
 import at.newmedialab.ldpath.model.fields.FieldMapping;
 import at.newmedialab.ldpath.model.programs.Program;
+import at.newmedialab.ldpath.parser.Configuration;
+import at.newmedialab.ldpath.parser.DefaultConfiguration;
 
 /**
  * {@link LDPath} with Entityhub specific configurations.
@@ -43,31 +46,34 @@ public class EntityhubLDPath extends LDP
 
     private final ValueFactory vf;
     private final RDFBackend<Object> backend;
+    /**
+     * Creates a {@link LDPath} instance configured as used with the Entityhub.
+     * This means support for<ul>
+     * <li> namespaces defined by the {@link NamespaceEnum}
+     * <li> {@link NodeTransformer} for {@link DataTypeEnum#Text} and 
+     * {@link DataTypeEnum#Reference}
+     * <li> and the usage of {@link Text} for <code>xsd:string</code> and
+     * {@link Reference} for <code>xsd:anyURI</code>
+     * @param backend the {@link RDFBackend}
+     */
     public EntityhubLDPath(RDFBackend<Object> backend) {
         this(backend,null);
     }
+    /**
+     * Creates a {@link LDPath} instance configured as used with the Entityhub.
+     * This means support for<ul>
+     * <li> namespaces defined by the {@link NamespaceEnum}
+     * <li> {@link NodeTransformer} for {@link DataTypeEnum#Text} and 
+     * {@link DataTypeEnum#Reference}
+     * <li> and the usage of {@link Text} for <code>xsd:string</code> and
+     * {@link Reference} for <code>xsd:anyURI</code>
+     * @param backend the {@link RDFBackend}
+     * @param vf the {@link ValueFactory} or <code>null</code> to use the default.
+     */
     public EntityhubLDPath(RDFBackend<Object> backend,ValueFactory vf) {
-        super(backend);
+        super(backend, new EntityhubConfiguration(vf));
         this.vf = vf == null ? InMemoryValueFactory.getInstance() : vf;
         this.backend = backend;
-        //register special Entutyhub Transformer for
-        // * entityhub:reference
-        ValueConverter<Reference> referenceConverter = new ReferenceConverter();
-        registerTransformer(referenceConverter.getDataType(), 
-            new ValueConverterTransformerAdapter<Reference>(referenceConverter,vf));
-        // * xsd:anyURI
-        ValueConverter<Reference> uriConverter = new AnyUriConverter();
-        registerTransformer(uriConverter.getDataType(), 
-            new ValueConverterTransformerAdapter<Reference>(uriConverter,vf));
-        // * entityhub:text
-        ValueConverter<Text> literalConverter = new TextConverter();
-        registerTransformer(literalConverter.getDataType(), 
-            new ValueConverterTransformerAdapter<Text>(literalConverter,vf));
-        // xsd:string (use also the literal converter for xsd:string
-        registerTransformer(DataTypeEnum.String.getUri(), 
-            new ValueConverterTransformerAdapter<Text>(literalConverter,vf));
-        //TODO: Currently it is NOT possible to register the default
-        //      Namespace mappings defined for the Entityhub!
     }
     
     /**
@@ -95,4 +101,35 @@ public class EntityhubLDPath extends LDP
         return result;
         
     }
+    /**
+     * The default configuration for the Entityhub
+     * @author Rupert Westenthaler
+     *
+     */
+    private static class EntityhubConfiguration extends DefaultConfiguration<Object>{
+        public EntityhubConfiguration(ValueFactory vf){
+            super();
+            vf = vf == null ? InMemoryValueFactory.getInstance() : vf;
+            //register special Entutyhub Transformer for
+            // * entityhub:reference
+            ValueConverter<Reference> referenceConverter = new ReferenceConverter();
+            addTransformer(referenceConverter.getDataType(), 
+                new ValueConverterTransformerAdapter<Reference>(referenceConverter,vf));
+            // * xsd:anyURI
+            ValueConverter<Reference> uriConverter = new AnyUriConverter();
+            addTransformer(uriConverter.getDataType(), 
+                new ValueConverterTransformerAdapter<Reference>(uriConverter,vf));
+            // * entityhub:text
+            ValueConverter<Text> literalConverter = new TextConverter();
+            addTransformer(literalConverter.getDataType(), 
+                new ValueConverterTransformerAdapter<Text>(literalConverter,vf));
+            // xsd:string (use also the literal converter for xsd:string
+            addTransformer(DataTypeEnum.String.getUri(), 
+                new ValueConverterTransformerAdapter<Text>(literalConverter,vf));
+            //Register the default namespaces
+            for(NamespaceEnum ns : NamespaceEnum.values()){
+                addNamespace(ns.getPrefix(), ns.getNamespace());
+            }
+        }
+    }
 }

Modified: incubator/stanbol/trunk/entityhub/ldpath/src/test/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPathTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/ldpath/src/test/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPathTest.java?rev=1215109&r1=1215108&r2=1215109&view=diff
==============================================================================
--- incubator/stanbol/trunk/entityhub/ldpath/src/test/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPathTest.java (original)
+++ incubator/stanbol/trunk/entityhub/ldpath/src/test/java/org/apache/stanbol/entityhub/ldpath/EntityhubLDPathTest.java Fri Dec 16 12:23:35 2011
@@ -38,17 +38,19 @@ public class EntityhubLDPathTest extends
     private static final String DATA_TYPE_TEST_PROGRAM;
     static {
         StringBuilder builder = new StringBuilder();
-        builder.append("@prefix eh : <http://www.iks-project.eu/ontology/rick/model/>;");
-        builder.append("@prefix dct : <http://purl.org/dc/terms/>;");
-        builder.append("@prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;");
+        //NOTE: prefixes removed to test registration of the default namespaces
+        //      as registered in the NamespaceEnum
+        //builder.append("@prefix eh : <http://www.iks-project.eu/ontology/rick/model/>;");
+        //builder.append("@prefix dct : <http://purl.org/dc/terms/>;");
+        //builder.append("@prefix geo : <http://www.w3.org/2003/01/geo/wgs84_pos#> ;");
         //this test that even when selecting strings the language is preserved
         builder.append("name = rdfs:label :: xsd:string;");
         //this tests support for natural language texts as used by the entityhub
-        builder.append("comment = rdfs:comment :: eh:text;");
+        builder.append("comment = rdfs:comment :: entityhub:text;");
         //this tests that Reference is used for URIs
-        builder.append("categories = dct:subject :: xsd:anyURI;");
+        builder.append("categories = dc:subject :: xsd:anyURI;");
         //this tests support for Reference as used by the entityhub
-        builder.append("type = rdf:type :: eh:ref;");
+        builder.append("type = rdf:type :: entityhub:ref;");
         builder.append("lat = geo:lat :: xsd:double;");
         DATA_TYPE_TEST_PROGRAM = builder.toString();