1

I'm running the same SPARQL Query on apache-jena-2.11.1 (eclipse 64jvm), Protégé and TopBraid Composer (free edition).

Jena returns an empty set while both Protégé and TopBraid Composer return/find the correct results.

The SPARQL Query:

PREFIX  core: <http://www.linked-usdl.org/ns/usdl-core#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  price: <http://www.linked-usdl.org/ns/usdl-price#>
PREFIX  pf:   <http://jena.hpl.hp.com/ARQ/property#>
PREFIX  spin: <http://spinrdf.org/spin#>
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  gr:   <http://purl.org/goodrelations/v1#>
PREFIX  cloudtaxonomy: <http://rdfs.genssiz.org/CloudTaxonomy#>

SELECT REDUCED  ?offering
WHERE
  { { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Location .
              ?f rdfs:label ?value
              FILTER REGEX(?value, "tokyo", "i")
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Location .
              ?f rdfs:label ?value
              FILTER REGEX(?value, "tokyo", "i")
            }
        }
    }
    { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:quantitativeProductOrServiceProperty cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:MemorySize .
              ?f gr:hasMinValue ?value
              FILTER ( ?value >= 3.7 )
            }
        }
    }
    { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:quantitativeProductOrServiceProperty cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:DiskSize .
              ?f gr:hasMinValue ?value
              FILTER ( ?value >= 150.0 )
            }
        }
    }
    { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Feature .
              ?f rdfs:label ?value
              FILTER REGEX(?value, "Virtual Machine", "i")
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Feature .
              ?f rdfs:label ?value
              FILTER REGEX(?value, "Virtual Machine", "i")
            }
        }
    }
  }

Jena's loading the information from the model correctly and every platform has the same data. No reasoner is being used on either of them.

JAVA source.

You can download the dataset from here.

Protégé and TopBraid find 19 results, Jena finds 0.

Jena:       VERSION: 2.11.1
Jena:       BUILD_DATE: 2014-01-18T19:01:20+0000
ARQ:        VERSION: 2.11.1
ARQ:        BUILD_DATE: 2014-01-18T19:01:20+0000
RIOT:       VERSION: 2.11.1
RIOT:       BUILD_DATE: 2014-01-18T19:01:20+0000

$ sparql --query query.qv --data amazonOnDemand_fullset0.ttl
------------
| offering |
============
------------

Any ideas on what might be the problem here? Running eclipse with jdk 1.8.0 64bits.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
smokez
  • 13
  • 5

1 Answers1

1

When I run this using Jena's command line tools (after downloading your data and storing your query in query.rq), I get a number of results. I don't know if they're what you expected, or what you're getting from Protégé, since you didn't post them, but it's not empty, so I assume it's what you're expecting.

$ sparql --version
Jena:       VERSION: 2.11.0
Jena:       BUILD_DATE: 2013-09-12T10:49:49+0100
ARQ:        VERSION: 2.11.0
ARQ:        BUILD_DATE: 2013-09-12T10:49:49+0100
RIOT:       VERSION: 2.11.0
RIOT:       BUILD_DATE: 2013-09-12T10:49:49+0100

$ sparql --query query.rq --data amazonOnDemand_fullset0.ttl 
---------------------------------------------------------------------------------------------------------------------------------------
| offering                                                                                                                            |
=======================================================================================================================================
| <http://PricingAPIAmazonOnDemandOfferings.com#m3.2xlarge_2956_TIME247806256606408linux-AmazonOnDemandInstance_TIME247806256614533>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#c3.4xlarge_3132_TIME247806265310896linux-AmazonOnDemandInstance_TIME247806265318593>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.xlarge_3352_TIME247806280140383linux-AmazonOnDemandInstance_TIME247806280147225>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#m1.xlarge_3044_TIME247806261045248linux-AmazonOnDemandInstance_TIME247806261052518>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#hi1.4xlarge_3462_TIME247806285100936linux-AmazonOnDemandInstance_TIME247806285106495> |
| <http://PricingAPIAmazonOnDemandOfferings.com#m2.4xlarge_3308_TIME247806277291059linux-AmazonOnDemandInstance_TIME247806277311157>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#cr1.8xlarge_3330_TIME247806279000311linux-AmazonOnDemandInstance_TIME247806279016134> |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.4xlarge_3396_TIME247806282156677linux-AmazonOnDemandInstance_TIME247806282162664>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#cc2.8xlarge_3220_TIME247806271984550linux-AmazonOnDemandInstance_TIME247806271997379> |
| <http://PricingAPIAmazonOnDemandOfferings.com#m2.xlarge_3264_TIME247806274243312linux-AmazonOnDemandInstance_TIME247806274255286>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#m2.2xlarge_3286_TIME247806275687432linux-AmazonOnDemandInstance_TIME247806275695557>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#m1.medium_3000_TIME247806258807012linux-AmazonOnDemandInstance_TIME247806258833953>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#hs1.8xlarge_3440_TIME247806284122937linux-AmazonOnDemandInstance_TIME247806284128497> |
| <http://PricingAPIAmazonOnDemandOfferings.com#m1.large_3022_TIME247806259925275linux-AmazonOnDemandInstance_TIME247806259933827>    |
| <http://PricingAPIAmazonOnDemandOfferings.com#c3.2xlarge_3110_TIME247806264234541linux-AmazonOnDemandInstance_TIME247806264242239>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.8xlarge_3418_TIME247806283147932linux-AmazonOnDemandInstance_TIME247806283153491>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#c1.xlarge_3198_TIME247806269972105linux-AmazonOnDemandInstance_TIME247806269986217>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.2xlarge_3374_TIME247806281161573linux-AmazonOnDemandInstance_TIME247806281167987>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#c3.8xlarge_3154_TIME247806266383402linux-AmazonOnDemandInstance_TIME247806266391099>  |
---------------------------------------------------------------------------------------------------------------------------------------

After the edit, you've provided complete code, but it still works. I've downloaded it, along with a copy of the data, and aside from a change to the path name, I get the results you'd expect.

import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.util.FileManager;

public class JenaVsProtegeAndTopBraidExample {

    public static void main(String[] args) {

        Model data = FileManager.get().loadModel( "/home/taylorj/Downloads/amazonOnDemand_fullset0.ttl", "TTL");
        test(data);
    }

    private static void test(Model model) {
        String q = "PREFIX core: <http://www.linked-usdl.org/ns/usdl-core#>  PREFIX price: <http://www.linked-usdl.org/ns/usdl-price#>  PREFIX pf: <http://jena.hpl.hp.com/ARQ/property#>  PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>  PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>  PREFIX gr: <http://purl.org/goodrelations/v1#>  PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>  PREFIX cloudtaxonomy: <http://rdfs.genssiz.org/CloudTaxonomy#> PREFIX spin: <http://spinrdf.org/spin#> SELECT REDUCED ?offering   WHERE {  {  SELECT REDUCED ?offering  WHERE {  ?offering rdf:type core:ServiceOffering.  ?offering core:includes ?serv .  {  ?serv gr:qualitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:Location .  ?f rdfs:label ?value  FILTER regex(?value, 'tokyo', 'i')  }UNION{  ?serv core:hasServiceModel ?model .  ?model gr:qualitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:Location .  ?f rdfs:label ?value  FILTER regex(?value, 'tokyo', 'i')  }  }  } . {  SELECT REDUCED ?offering  WHERE {  ?offering rdf:type core:ServiceOffering . ?offering core:includes ?serv .  {  ?serv gr:quantitativeProductOrServiceProperty cloudtaxonomy:MemorySize .  ?f gr:hasValue ?value  FILTER(?value >= 3.7)  }UNION{  ?serv gr:quantitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:MemorySize .  ?f gr:hasValue ?value  FILTER(?value >= 3.7)  }UNION{  ?serv core:hasServiceModel ?model .  ?model gr:quantitativeProductOrServiceProperty cloudtaxonomy:MemorySize .  ?f gr:hasValue ?value  FILTER(?value >= 3.7)  }UNION{  ?serv core:hasServiceModel ?model .  ?model gr:quantitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:MemorySize .  ?f gr:hasValue ?value  FILTER(?value >= 3.7)  } UNION{  ?serv core:hasServiceModel ?model .  ?model gr:quantitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:MemorySize .  ?f gr:hasMinValue ?value  FILTER(?value >= 3.7)  }  }  } . {  SELECT REDUCED ?offering  WHERE {  ?offering rdf:type core:ServiceOffering . ?offering core:includes ?serv .  {  ?serv gr:quantitativeProductOrServiceProperty cloudtaxonomy:DiskSize .  ?f gr:hasValue ?value  FILTER(?value >= 150.0)  }UNION{  ?serv gr:quantitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:DiskSize .  ?f gr:hasValue ?value  FILTER(?value >= 150.0)  }UNION{  ?serv core:hasServiceModel ?model .  ?model gr:quantitativeProductOrServiceProperty cloudtaxonomy:DiskSize .  ?f gr:hasValue ?value  FILTER(?value >= 150.0)  }UNION{  ?serv core:hasServiceModel ?model .  ?model gr:quantitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:DiskSize .  ?f gr:hasValue ?value  FILTER(?value >= 150.0)  } UNION{  ?serv core:hasServiceModel ?model .  ?model gr:quantitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:DiskSize .  ?f gr:hasMinValue ?value  FILTER(?value >= 150.0)  }  }  } . {  SELECT REDUCED ?offering  WHERE {  ?offering rdf:type core:ServiceOffering.  ?offering core:includes ?serv .  {  ?serv gr:qualitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:Feature .  ?f rdfs:label ?value  FILTER regex(?value, 'Virtual Machine', 'i')  }UNION{  ?serv core:hasServiceModel ?model .  ?model gr:qualitativeProductOrServiceProperty ?f .  ?f rdf:type cloudtaxonomy:Feature .  ?f rdfs:label ?value  FILTER regex(?value, 'Virtual Machine', 'i')  }  }  }  }";

        Query query = QueryFactory.create(q);
        System.out.println(query.toString());

        QueryExecution exec = QueryExecutionFactory.create(query, model);

        ResultSet results = exec.execSelect();
        ResultSetFormatter.out(System.out, results, query);

        exec.close();
    }
}

Output:

PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX  pf:   <http://jena.hpl.hp.com/ARQ/property#>
PREFIX  price: <http://www.linked-usdl.org/ns/usdl-price#>
PREFIX  xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX  spin: <http://spinrdf.org/spin#>
PREFIX  core: <http://www.linked-usdl.org/ns/usdl-core#>
PREFIX  cloudtaxonomy: <http://rdfs.genssiz.org/CloudTaxonomy#>
PREFIX  gr:   <http://purl.org/goodrelations/v1#>

SELECT REDUCED  ?offering
WHERE
  { { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Location .
              ?f rdfs:label ?value
              FILTER regex(?value, "tokyo", "i")
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Location .
              ?f rdfs:label ?value
              FILTER regex(?value, "tokyo", "i")
            }
        }
    }
    { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:quantitativeProductOrServiceProperty cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:MemorySize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 3.7 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:MemorySize .
              ?f gr:hasMinValue ?value
              FILTER ( ?value >= 3.7 )
            }
        }
    }
    { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:quantitativeProductOrServiceProperty cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:DiskSize .
              ?f gr:hasValue ?value
              FILTER ( ?value >= 150.0 )
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:quantitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:DiskSize .
              ?f gr:hasMinValue ?value
              FILTER ( ?value >= 150.0 )
            }
        }
    }
    { SELECT REDUCED  ?offering
      WHERE
        { ?offering rdf:type core:ServiceOffering .
          ?offering core:includes ?serv
            { ?serv gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Feature .
              ?f rdfs:label ?value
              FILTER regex(?value, "Virtual Machine", "i")
            }
          UNION
            { ?serv core:hasServiceModel ?model .
              ?model gr:qualitativeProductOrServiceProperty ?f .
              ?f rdf:type cloudtaxonomy:Feature .
              ?f rdfs:label ?value
              FILTER regex(?value, "Virtual Machine", "i")
            }
        }
    }
  }

---------------------------------------------------------------------------------------------------------------------------------------
| offering                                                                                                                            |
=======================================================================================================================================
| <http://PricingAPIAmazonOnDemandOfferings.com#m3.2xlarge_2956_TIME247806256606408linux-AmazonOnDemandInstance_TIME247806256614533>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#c3.4xlarge_3132_TIME247806265310896linux-AmazonOnDemandInstance_TIME247806265318593>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.xlarge_3352_TIME247806280140383linux-AmazonOnDemandInstance_TIME247806280147225>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#m1.xlarge_3044_TIME247806261045248linux-AmazonOnDemandInstance_TIME247806261052518>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#hi1.4xlarge_3462_TIME247806285100936linux-AmazonOnDemandInstance_TIME247806285106495> |
| <http://PricingAPIAmazonOnDemandOfferings.com#m2.4xlarge_3308_TIME247806277291059linux-AmazonOnDemandInstance_TIME247806277311157>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#cr1.8xlarge_3330_TIME247806279000311linux-AmazonOnDemandInstance_TIME247806279016134> |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.4xlarge_3396_TIME247806282156677linux-AmazonOnDemandInstance_TIME247806282162664>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#cc2.8xlarge_3220_TIME247806271984550linux-AmazonOnDemandInstance_TIME247806271997379> |
| <http://PricingAPIAmazonOnDemandOfferings.com#m2.xlarge_3264_TIME247806274243312linux-AmazonOnDemandInstance_TIME247806274255286>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#m2.2xlarge_3286_TIME247806275687432linux-AmazonOnDemandInstance_TIME247806275695557>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#m1.medium_3000_TIME247806258807012linux-AmazonOnDemandInstance_TIME247806258833953>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#hs1.8xlarge_3440_TIME247806284122937linux-AmazonOnDemandInstance_TIME247806284128497> |
| <http://PricingAPIAmazonOnDemandOfferings.com#m1.large_3022_TIME247806259925275linux-AmazonOnDemandInstance_TIME247806259933827>    |
| <http://PricingAPIAmazonOnDemandOfferings.com#c3.2xlarge_3110_TIME247806264234541linux-AmazonOnDemandInstance_TIME247806264242239>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.8xlarge_3418_TIME247806283147932linux-AmazonOnDemandInstance_TIME247806283153491>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#c1.xlarge_3198_TIME247806269972105linux-AmazonOnDemandInstance_TIME247806269986217>   |
| <http://PricingAPIAmazonOnDemandOfferings.com#i2.2xlarge_3374_TIME247806281161573linux-AmazonOnDemandInstance_TIME247806281167987>  |
| <http://PricingAPIAmazonOnDemandOfferings.com#c3.8xlarge_3154_TIME247806266383402linux-AmazonOnDemandInstance_TIME247806266391099>  |
---------------------------------------------------------------------------------------------------------------------------------------
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Yes, those are the correct results. Both Protégé and TopBraid Composer find them correctly. Jena, on the other hand, returns me an empty set. – smokez May 27 '14 at 22:56
  • No, see, that was my point. The `sparql` command there *is* Jena. If you're getting different results, then it almost certainly has something to do with the Java code that you *haven't* shown us. E.g., if you're building the query from the concatenation of strings, it's very easy to miss a space and end up with a different query than what you expect. In any case, you haven't shown us that code yet. – Joshua Taylor May 27 '14 at 22:58
  • @smokez Thanks for editing; I've downloaded the source and the data, and it still works. See the update to the answer. When I used the `sparql` command, I made a point to show Jena version numbers. What versions are *you* using? I doubt that makes a difference here, but it's worth asking. – Joshua Taylor May 27 '14 at 23:08
  • Thanks for reproducing the scenario. I tried using the same approach as you, but i got the same empty result. Jena: VERSION: 2.11.1 Jena: BUILD_DATE: 2014-01-18T19:01:20+0000 ARQ: VERSION: 2.11.1 ARQ: BUILD_DATE: 2014-01-18T19:01:20+0000 RIOT: VERSION: 2.11.1 RIOT: BUILD_DATE: 2014-01-18T19:01:20+0000 >sparql --query query.qv --data amazonOnDemand_fullset0.ttl ------------ | offering | ============ ------------ – smokez May 27 '14 at 23:21
  • Tried both the String format of the query (q attribute on the JAVA class) and the String returned by query.toString(). – smokez May 27 '14 at 23:23
  • @smokez Well, I don't really know what to tell you, I'm afraid. I'd start with: download your data from the link in your question; maybe for some reason you've got different data locally (does a query like `select * { ?s ?p ?o } limit 100` return anything?). Then, copy the query from your question and paste it into a new file. Then use Jena's command line tools. Do you still get no results? – Joshua Taylor May 27 '14 at 23:23
  • The query you posted returns the results it should, retried with the query I posted and the empty result still persists. The datasets are the same. – smokez May 27 '14 at 23:34
  • @smokez In the first example, I copied and pasted the query from your question. In the second example, I just used the code in your pastebin post. I haven't changed the query. Do you have some odd characters or something in your original query that aren't coming across when you copy & paste (that's why I suggested copying and pasting the query *from your question*). – Joshua Taylor May 27 '14 at 23:35
  • Exactly, that's why I'm at a loss as what to do. I've tried different versions of Jena, no difference; 32bit JAVA7 no difference. I'm running Windows8 64bit, don't know if that might be the issue but I doubt it. – smokez May 27 '14 at 23:38
  • But you said that you downloaded the query from my question and ran it and it worked? Try saving it, along with your query, in files, and running `diff` on them. Maybe there's a hidden difference. – Joshua Taylor May 27 '14 at 23:39
  • the original query is the one you see in the code, it's generated automatically. The query I posted is the query.toString() version. – smokez May 27 '14 at 23:40
  • I was referring to this one: select * { ?s ?p ?o } limit 100. Sry for not mentioning it. – smokez May 27 '14 at 23:41
  • I run my code on a different laptop (Windows7 64bit) with JAVA6 and same jena version and got the same empty result. The only connection i see is the 64bit OS but i doubt that is the problem? – smokez May 27 '14 at 23:48
  • Well, I think you may be at the point where you should start trimming down the files you've got and identifying at what point the problem begins, and thenlook to see what the difference was. – Joshua Taylor May 28 '14 at 00:05
  • There's just one file, the dataset I posted. The file on the directory of the JAVA project is an exact copy of the one used by TopBraid/Protégé. The problem is the return of an empty set where there should be 19 results (the ones you posted). The JAVA code is quite simple as you can see, it just loads the model and runs the query "q". You didn't change anything and got the right results while I keep getting the same results either by running the code or using the sparql.bat directly. – smokez May 28 '14 at 00:20
  • When you were running on the command line, there were two files: the query file and the data file. Each could be the problem. – Joshua Taylor May 28 '14 at 01:09
  • 2
    I think I found the problem, if you try it with jena 2.11.1 you should get an empty result set as well. It could be a bug in the version. I tried your version, 11.0 and got the correct results. Thanks for the help! – smokez May 28 '14 at 01:22
  • 1
    This does indeed look like a bug, disabling the optimiser (add `--set arq:optimizer=false` as an argument to the `sparql` command) or using the reference query engine (add `--engine=ref` as an argument to the `sparql` command) does give results with 2.11.1/current trunk. I have filed this as [JENA-705](https://issues.apache.org/jira/browse/JENA-705) – RobV May 28 '14 at 13:55
  • 1
    The cause of the bug has been identified and fixed and will be included in the next release – RobV May 30 '14 at 06:46