-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering by gYear #32
Comments
I played some more with the SPARQL query and quite oddly, these all return the expected results (notice the use of
but I'm really not sure why? Also, these do not work:
|
Here's how, and I understand it would have been hard to come up with it, it's quite rdfjs specific: You have to construct a literal to compare to: Full example: const entryPoint = new DataCubeEntryPoint(
"https://trifid-lindas.test.cluster.ldbar.ch/query",
{ languages: ["de"] },
);
const dataCubes = await entryPoint.dataCubes();
const cube = dataCubes[0];
const dimensions = await cube.dimensions();
const year = dimensions[0];
const forstzone = dimensions[1];
const kanton = dimensions[2];
const results = await cube.query()
.select({
year,
forstzone,
kanton,
})
.filter(year.equals(literal("2017", namedNode("http://www.w3.org/2001/XMLSchema#gYear"))))
.execute(); You should be able to import import { literal, namedNode } from "@rdfjs/data-model"; |
Thanks, I'll give it a shot. |
Doesn't work for non-year types yet. Cf. zazuko/query-rdf-data-cube#32 (comment)
OK, it works. But … It's quite brittle IMO.
P.S. Maybe even this could work: |
FYI, I'm going to implement 2. from my previous comment because it's actually useful to know dimension values/minmax in a few places, not just for filtering. So no hurry for something like 4. (which I still think is nicer 😉 ). |
We definitely need to invest time into the representation of time in the cube model but that will have to wait for next year I'm afraid. As a workaround, could we use the datatype for the literal that we have in the shape @vhf ? It is not directly attached to the current |
Unfortunately not. The best we can do at the moment is a workaround like scaleOfMeasure. |
Yes that's what I mean so I could add it as |
@ktk I noticed that while filtering by E.g. This works: I suspect this is some particularity of SPARQL itself or Stardog's implementation but I wonder if there is a good way to handle these issues. |
Oddly, this works too: |
Hi @vhf!
A follow-up to our discussion about filtering by years (and probably other date types). While this works fine for non-literal dimensions:
… it doesn't for
xsd:gYear
values. For example:generates a SPARQL query with
… which leads to no results (see http://yasgui.org/short/VyGPg76bB).
Expected outcome
The expected (working) SPARQL should be
(see http://yasgui.org/short/7QS7K16Nl)
Solution?
So, I think there needs to be a way to provide a typed value to
.filter()
– but how? I tried this:… but that just generates an error in the library:
The text was updated successfully, but these errors were encountered: