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

Optimize SPARQL provider #218

Open
jakubklimek opened this issue Aug 31, 2020 · 1 comment
Open

Optimize SPARQL provider #218

jakubklimek opened this issue Aug 31, 2020 · 1 comment
Assignees

Comments

@jakubklimek
Copy link
Member

jakubklimek commented Aug 31, 2020

The label query does not use the "GRAPH" pattern. Therefore, publisher labels are searched for in cartesian products of many named graphs - the publisher name is present in each dataset graph in out endpoints.

function createLabelSparql(iri, language) {

Therefore, we need to add option to enclose the WHERE clause in GRAPH {} like this:

PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
CONSTRUCT { <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?object } WHERE { GRAPH ?g {
  <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?object .
  
  OPTIONAL { 
    <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?label_primary . 
    FILTER(LANG(?label_primary) = "cs") 
  }
  OPTIONAL { 
    <https://data.gov.cz/zdroj/ovm/MinFin> ?predicate ?label_secondary . 
    FILTER(LANG(?label_secondary) = "en")
  } }
  
  BIND( COALESCE(?label_primary, ?label_secondary) as ?label )
  
  VALUES ( ?predicate ) {
   ( foaf:name )
   ( skos:prefLabel )
   ( dcterms:title )
   ( rdfs:label )
  }
}
@jakubklimek jakubklimek changed the title SPARQL-mode label query wrong SPARQL-mode label query GRAPH usage Aug 31, 2020
skodapetr added a commit that referenced this issue Sep 3, 2020
Update query #218, and add log for long running queries.
@skodapetr skodapetr changed the title SPARQL-mode label query GRAPH usage Optimize SPARQL provider Sep 3, 2020
@skodapetr
Copy link
Member

The createLabelSparql method now utilize GRAPH to enclose the content of the query in case of datasetPerGraph set to true.

@skodapetr skodapetr assigned jakubklimek and unassigned skodapetr Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants