qlever icon indicating copy to clipboard operation
qlever copied to clipboard

Exception: Triples should have at least one variable.

Open ktk opened this issue 2 years ago • 3 comments

I'm running a query in the form of:

SELECT *
WHERE {
  <https://ld.stadt-zuerich.ch/statistics/000201> a cube:Cube;
             cube:observationSet/cube:observation ?observation.   
  
  ?observation property:RAUM ?place_uri ;
                       property:TIME ?time ;
                       measure:BEW ?count .
...
}

And it complains about:

"exception": "BAD QUERY (Triples should have at least one variable. Not the case in: {s: <https://ld.stadt-zuerich.ch/statistics/000201>, p: <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>, o: <https://cube.link/Cube>}; in /app/src/engine/QueryPlanner.cpp, line 756, function std::vector<QueryPlanner::SubtreePlan> QueryPlanner::seedWithScansAndText(const QueryPlanner::TripleGraph&, const std::vector<std::vector<QueryPlanner::SubtreePlan> >&))",

When I comment the a cube:Cube; part it just works fine. So it does not like the fact that I set a type first before I get data.

ktk avatar Nov 30 '22 17:11 ktk

@ktk Thanks for the feedback, Adrian. Yes, as the error message says, QLever currently does not support triples without variables in the query. It would be easy to implement though: if the triple exist, ignore it, and if it does not exist, the associated query part has an empty result. We wonder: is there an actual use case for this or are you just curious?

hannahbast avatar Nov 30 '22 20:11 hannahbast

As far as I can remember I always wrote SPARQL queries that way, it represents how I map the question into a query. In this case it's something like "get me this cube, fetch all observations and...". Yes it's more common to have at least one variable, often I write the query with ?subject open and only later "fix" it to one specific subject.

I'm also quite sure SPARQL allows that as this is the first time I see a store complaining about it ;)

By the way very nice work with the current setup! I've loaded 13M triples on a cheap 5€/month VM in 2 minutes. The new shell script is nice, at least once I figured out that it does not work in zsh and indeed does require bash.

I plan to do a lot more tests with very join heavy RDF cubes we provide for our customers. Most stores I've tried so far bail out quite fast on those queries.

ktk avatar Dec 01 '22 07:12 ktk

Thanks, Adrian!

triples without variables: Yeah, we checked it yesterday, the standard allows it, so we will of course implement it, shouldn't be a big deal. It's just that we are prioritizing the useful stuff.

script: Great to hear that it works for you. I also find it super convenient, especially with all the configuration in one Qleverfile and the maximally simple commands for the typical use cases. But yeah, it currently only works with bash and there are problems with bash on Mac OS. I wonder whether a Python script would be more appropriate. Thoughts?

tests: Really looking forward to your feedback from such stress tests. BTW, we now also have something like UniProt, which contains a whopping 106 billion triples, running on a single machine: https://qlever.cs.uni-freiburg.de/uniprot .

hannahbast avatar Dec 01 '22 07:12 hannahbast

@hannahbast just want to bring this issue again into focus.

As Adrian has already said it is a very common way of working with queries. Writing generic queries with all variables and then replacing a specific variable with some value. And currently qlever doesn't like such fully bound triple patterns.

aindlq avatar Jul 08 '24 09:07 aindlq

@aindlq Thanks for the reminder. I have just opened a first draft for this feature in #1395, it seems to work at first glance, so you can expect progress here in the next few days/weeks.

joka921 avatar Jul 11 '24 15:07 joka921