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

Some SPARQL queries fail on Virtuoso - create a VirtuosoSparql dialect ? #644

Closed
tfrancart opened this issue Oct 26, 2017 · 4 comments · Fixed by #645
Closed

Some SPARQL queries fail on Virtuoso - create a VirtuosoSparql dialect ? #644

tfrancart opened this issue Oct 26, 2017 · 4 comments · Fixed by #645
Milestone

Comments

@tfrancart
Copy link
Contributor

tfrancart commented Oct 26, 2017

When using a connection to a Virtuoso-backed SPARQL endpoint, some queries fail :

SELECT * FROM <http://data.legilux.public.lu/resource/authority/legal-institution-history/graph>
WHERE {
  SELECT ?object ?label (GROUP_CONCAT(?dir) as ?direct)
  WHERE {
    <http://data.legilux.public.lu/resource/authority/legal-institution-historique/147> a skos:Concept .
    OPTIONAL {
      <http://data.legilux.public.lu/resource/authority/legal-institution-historique/147> skos:broader* ?object .
      OPTIONAL {
        ?object skos:broader ?dir .
      }
    }
    OPTIONAL {
      ?object skos:prefLabel ?label .
      FILTER (langMatches(lang(?label), "fr"))
    }
    OPTIONAL { ?object skos:prefLabel ?label }
  }
  GROUP BY ?object ?label
}
LIMIT 1000

This query can be tested at http://data.legilux.public.lu/sparql

Virtuoso requires a separator argument :

SELECT * FROM <http://data.legilux.public.lu/resource/authority/legal-institution-history/graph>
WHERE {
  SELECT ?object ?label (GROUP_CONCAT(?dir; separator=' ') as ?direct)
  WHERE {
    <http://data.legilux.public.lu/resource/authority/legal-institution-historique/147> a skos:Concept .
    OPTIONAL {
      <http://data.legilux.public.lu/resource/authority/legal-institution-historique/147> skos:broader* ?object .
      OPTIONAL {
        ?object skos:broader ?dir .
      }
    }
    OPTIONAL {
      ?object skos:prefLabel ?label .
      FILTER (langMatches(lang(?label), "fr"))
    }
    OPTIONAL { ?object skos:prefLabel ?label }
  }
  GROUP BY ?object ?label
}
LIMIT 1000

Should I subclass GenericSparql with a VirtuosoSparql maybe ?

@tfrancart tfrancart changed the title Virtuoso does not like SPARQL with transitive (*) operator Some SPARQL queries fail on Virtuoso - create a VirtuosoSparql dialect ? Oct 26, 2017
@osma
Copy link
Member

osma commented Oct 26, 2017

That's strange. Path expressions have been in SPARQL 1.1 for a long time. Are you using some old version of Virtuoso? I have minimal experience with it but I'd think this would be a pretty basic feature. It's hard to substitute by rewriting queries since * means a property can be chained any number of times.

@osma
Copy link
Member

osma commented Oct 26, 2017

Go ahead and create a VirtuosoSparql class if it helps solve your problem. Note that we rely on class autoloading so you need to run composer update after adding a new class.

@osma
Copy link
Member

osma commented Oct 26, 2017

Hmm, did you already resolve the transitive operator issue this was originally about?

The separator argument could be simply added to GenericSparql. No need to create a subclass just for that.

@tfrancart
Copy link
Contributor Author

tfrancart commented Oct 26, 2017 via email

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

Successfully merging a pull request may close this issue.

2 participants