Skip to content
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

SPARQL filter #535

Open
sinanatra opened this issue Dec 14, 2021 · 9 comments
Open

SPARQL filter #535

sinanatra opened this issue Dec 14, 2021 · 9 comments

Comments

@sinanatra
Copy link

Which SPARQL filter are supported now?

FILTER(contains(?var, "value to match)) does not filter anything.

@TallTed
Copy link
Contributor

TallTed commented Dec 14, 2021

Well... You're missing a closing quotation mark. But maybe this isn't the FILTER clause you're actually using. So maybe show us the clause you're actually using, and the value you're expecting it to match?

@sinanatra
Copy link
Author

ops, yes it should have been FILTER(contains(?var, "value to match")). Anyway, i want to filter all the E12_Production which contains a specific string in the P3_has_note , e.g. Datierung Kleidung. This is the property in my turtle

@prefix crm: <http://erlangen-crm.org/200717/>.

<_:b2>
    a crm:E12_Production;
    crm:P3_has_note
    "Datierung Kleidung (Modewissenschaftliche Einsch\\u00e4tzung)";
    crm:P4_has_time-span <_:b3>;
    crm:P70i_is_documented_in items:6076.
<_:b3> a crm:E52_Time-Span; crm:P82_at_some_time_within "01.01.1550 - 31.12.1599".

Launching this query i don't get any filtering:

PREFIX crm: <http://erlangen-crm.org/200717/>.
SELECT *
WHERE {
   ?productionEvent a crm:E12_Production ;
    crm:P4_has_time-span  ?timeSpan .

    ?productionEvent a crm:E12_Production ;
    crm:P3_has_note ?note 
    FILTER(contains(?note, "Datierung Kleidung")) .

    ?timeSpan  crm:P82_at_some_time_within ?time . 
}

Screenshot 2021-12-15 at 09 40 57

@TallTed
Copy link
Contributor

TallTed commented Dec 15, 2021

OK, that looks more like what I was expecting to see, and it does look like you should get the desired result. What is the target SPARQL engine (name, version, and platform; all may matter)? Is it a publicly accessible endpoint (such that we can experiment)?

@sinanatra
Copy link
Author

So far it's not public. I am fetching data from the API (structured in json-ld) of our Omeka S server, which i then parse with $rdf.parse and i am now trying to query with $rdf.SPARQLToQuery.

@TallTed
Copy link
Contributor

TallTed commented Dec 15, 2021

My best guess from the limited information at hand is a bug in the SPARQL processor. A log from it, and possibly logs from any other components involved that can produce them, may help confirm that and/or pinpoint what the issue is.

@jeff-zucker
Copy link
Contributor

jeff-zucker commented Dec 15, 2021

The SPARQL engine in rdflib is not fully SPARQL 1.1 compliant and is also, unfortunately, not very well documented. It does NOT support Filter.

@sinanatra
Copy link
Author

is the support planned for the future?

@jeff-zucker
Copy link
Contributor

jeff-zucker commented Dec 15, 2021

We are considering options on SPARQL, possibly piggy-backing on another engine such as @RubenVerborgh's SPARQL.js . Rdflib's parsing may be weak but excels in loading (handles CORS, alternate formats) and following (loading all documents in a query, not assuming a single triplestore). It's possible to use comunica or sparql.js in conjunction with rdlib though it requires some dumping of quads from one format to the other. But no, sorry, no specific plans on FILTER.

@RubenVerborgh
Copy link
Member

@jeff-zucker That's great. Note that both the loading and the link following are part of Comunica as well. Comunica has extended format support (also parsing JSON-LD inside of HTML, for instance) and extensive configurations for different kinds of traversal. So I can recommend it for more advanced SPARQL queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

4 participants