tanktoo
tanktoo

Reputation: 301

SPARQL 1.1 wildcard paths in Virtuoso 7.2

I had a question regarding deletion of triples and their related subproperties with SPARQL that has been answered successfully here.

The solution with the wildcard path is very nice and does exactly what I need but it is not working with my Virtuoso 7.2 installation (It deletes nothing). I have an additional test installation of Jena/Fuseki where the query is executed successfully. Now my question: Does anybody know if this query with wildcard path is not supported by Virtuoso, and if this is the case, is there any alternative solution?

Within the last answer there is also a another linked example to check if a path exists between two entities. This is working with Jena/Fuseki too, but Virtuoso always returns true even if there is definitely no relation.

As I didn't find anything about Virtuosos capabilities, and I am not allowed to post in the official forum, I hope that I found someone who could answer my question.

Edit:

@prefix xy: <http://purl.oclc.org/NET/xy/xy#> .
@prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#> .
@prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .

<http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> a xy:Point ;
    xy:value "10" ;
    ssn:observationResultTime <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> ;
    ssn:observationSamplingTime <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> ;
    ssn:observedBy <http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> .

<http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> a tl:Instant ;
    tl:at "2014-08-01T10:05:00" .

<http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> a ssn:Sensor .

<http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> a tl:Instant ;
    tl:at "2014-08-01T10:05:00" .


@prefix xy: <http://purl.oclc.org/NET/xy/xy#> .
@prefix ssn: <http://purl.oclc.org/NET/ssnx/ssn#> .
@prefix tl: <http://purl.org/NET/c4dm/timeline.owl#> .

<http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> a xy:Point ;
    xy:value "10" ;
    ssn:observationResultTime <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> ;
    ssn:observationSamplingTime <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> ;
    ssn:observedBy <http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> .

<http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> a tl:Instant ;
    tl:at "2014-08-01T10:10:00" .

<http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> a ssn:Sensor .

<http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> a tl:Instant ;
    tl:at "2014-08-01T10:10:00" .

This is my test graph. It is the same in Virtuoso (Version: 07.20.3212, Build: Feb 23 2015) and Apache Jena Fuseki (Version 2.3.0).

First query:

ASK {GRAPH <http://ict-citypulse.eu/store/testGraph2>{
  <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> ((<>|!<>)|^(<>|!<>))* <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> . 
}}

In Virtuoso this query returns "true" at every time even when I change one of the names to a non existing one. In Fuseki it works as expected and returns "true/false" if I change names.

The second query, which does exactly what I need (if I change it to delete):

select *
where {
  GRAPH <http://ict-citypulse.eu/store/testGraph2> {
    <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> (<>|!<>)* ?s . 
    ?s ?p ?o .
  }
}

On Virtuoso, this query returns nothing. In Fuseki, it returns exactly 10 triples, which is one of the committed graphs.

I hope this helps to explain my problem. Thanks for your help!

Edit: I have now tried the queries with the newest Virtuoso build (Version: 07.20.3214, Build: Oct 20 2015). I tried both, the stable and the develop version. With both I have the same behaviour as described above. Here is the query to insert my test data if this help you to replay the problem:

INSERT DATA INTO GRAPH <http://ict-citypulse.eu/store/testGraph2> {<http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/xy/xy#Point> . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/ssnx/ssn#observationResultTime> <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/xy/xy#value> "10" . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> . <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.oclc.org/NET/ssnx/ssn#observationSamplingTime> <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> . <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/Rs_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:05:00" . <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/St_94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:05:00" . <http://test.eu/SensorID-94456715-6a9c-4c0d-9af0-fe289602e7c9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/ssnx/ssn#Sensor> .   <http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/ssnx/ssn#Sensor> . <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:10:00" . <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.org/NET/c4dm/timeline.owl#at> "2014-08-01T10:10:00" . <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/timeline.owl#Instant> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/xy/xy#value> "10" . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/ssnx/ssn#observationSamplingTime> <http://test.eu/St_3c2cd1d4-c277-4663-a281-b2ea4917bd49> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.oclc.org/NET/xy/xy#Point> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/ssnx/ssn#observationResultTime> <http://test.eu/Rs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> . <http://test.eu/Obs_3c2cd1d4-c277-4663-a281-b2ea4917bd49> <http://purl.oclc.org/NET/ssnx/ssn#observedBy> <http://test.eu/SensorID-3c2cd1d4-c277-4663-a281-b2ea4917bd49> .  }

I have exchanged the URIs in the queries above to match the insert query.

Upvotes: 1

Views: 461

Answers (1)

tanktoo
tanktoo

Reputation: 301

A member of our research team found out a Virtuoso specific solution that is working:

prefix : <http://test.com/>

select *
where {
  {
    <http://test.eu/Obs_94456715-6a9c-4c0d-9af0-fe289602e7c9> (!:)* ?s .
    ?s ?p ?o .
  }
}

Maybe this might help other people.

Upvotes: 0

Related Questions