Author: rwesten
Date: Tue Nov  5 15:21:46 2013
New Revision: 1539028

URL: http://svn.apache.org/r1539028
Log:
merged fix for STANBOL-1203 to the 0.12.0 releasing branch

Modified:
    
stanbol/branches/release-0.12/entityhub/yard/sesame/src/main/java/org/apache/stanbol/entityhub/yard/sesame/SesameYard.java

Modified: 
stanbol/branches/release-0.12/entityhub/yard/sesame/src/main/java/org/apache/stanbol/entityhub/yard/sesame/SesameYard.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/release-0.12/entityhub/yard/sesame/src/main/java/org/apache/stanbol/entityhub/yard/sesame/SesameYard.java?rev=1539028&r1=1539027&r2=1539028&view=diff
==============================================================================
--- 
stanbol/branches/release-0.12/entityhub/yard/sesame/src/main/java/org/apache/stanbol/entityhub/yard/sesame/SesameYard.java
 (original)
+++ 
stanbol/branches/release-0.12/entityhub/yard/sesame/src/main/java/org/apache/stanbol/entityhub/yard/sesame/SesameYard.java
 Tue Nov  5 15:21:46 2013
@@ -627,8 +627,10 @@ public class SesameYard extends Abstract
      * SPARQL.
      */
     private TupleQueryResult executeSparqlFieldQuery(RepositoryConnection con, 
final SparqlFieldQuery fieldQuery, int limit, boolean select) throws 
RepositoryException, YardException, QueryEvaluationException {
+        log.debug("> execute FieldQuery: {}", fieldQuery);
         String sparqlQueryString = SparqlQueryUtils.createSparqlSelectQuery(
-            fieldQuery, select,limit,SparqlEndpointTypeEnum.Sesame);
+            fieldQuery, select, limit, SparqlEndpointTypeEnum.Sesame);
+        log.debug(" - SPARQL Query: {}", sparqlQueryString);
         TupleQuery sparqlOuery;
         try {
             sparqlOuery = con.prepareTupleQuery(QueryLanguage.SPARQL, 
sparqlQueryString);
@@ -718,6 +720,7 @@ public class SesameYard extends Abstract
             //create an own valueFactors so that all the data of the query 
results
             //are added to the same Sesame Model
             Model model = new TreeModel();
+            RdfValueFactory valueFactory = new RdfValueFactory(model, 
sesameFactory);
             List<Representation> representations = new 
ArrayList<Representation>(limit);
             Map<String,URI> bindings = new 
HashMap<String,URI>(query.getFieldVariableMappings().size());
             for(Entry<String,String> mapping : 
query.getFieldVariableMappings().entrySet()){
@@ -734,9 +737,11 @@ public class SesameYard extends Abstract
                     for(String binding : result.getBindingNames()){
                         URI property = bindings.get(binding);
                         if(property != null){
-                            model.add(subject, property, value);
+                            model.add(subject, property, 
result.getValue(binding));
                         } //else no mapping for the query.getRootVariableName()
                     }
+                    //create a representation and add it to the results
+                    
representations.add(valueFactory.createRdfRepresentation(subject));
                 } //ignore non URI results
             }
             con.commit();


Reply via email to