1

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.

Community
  • 1
  • 1
tanktoo
  • 181
  • 12
  • You might also try using a "real" IRI in the wildcard instead of the `<>`. E.g., do `(ex:foo|!ex:foo)*`. Also, if you can guarantee that some property, e.x., `ex:neverUsedProperrty`, you can just do `ex:neverUsedProperty*`. – Joshua Taylor Oct 16 '15 at 18:44
  • http://stackoverflow.com/q/31565565/1281433 might be relevant – Joshua Taylor Oct 16 '15 at 18:45
  • Have you read over [relevant Virtuoso documentation](http://www.openlinksw.com/dataspace/doc/dav/wiki/Main/VirtTipsAndTricksSPARQL11FeaturesExamplesCollection)? Are you running the latest Virtuoso 7.2.1? (also, Commercial or Open Source?) I don't know what you mean by "not allowed to post in the official forum"... Do you mean the [Virtuoso users mailing list](https://lists.sourceforge.net/lists/listinfo/virtuoso-users/), the [public support forums](http://boards.openlinksw.com/support/), somewhere else? (obDisclaimer: I work for [OpenLink Software](http://www.openlinksw.com/).) – TallTed Oct 17 '15 at 15:02
  • 1
    Also -- it will help us help you, if you include here the exact query that works against Jena/Fuseki, and fails against Virtuoso. If you can demonstrate the problem against a public Virtuoso endpoint (e.g., [DBpedia](http://dbpedia.org/sparql), [URIburner](http://linkeddata.uriburner.com/sparql/), [LOD Cloud Cache](http://lod.openlinksw.com/sparql)), that is often extremely helpful. – TallTed Oct 17 '15 at 15:05
  • 1
    I also note -- you reference both Virtuoso 7.1 and 7.2 -- please correct whichever is incorrect. It usually helps to provide the complete version string (from the `virtuoso -?` command) including "as of" date. – TallTed Oct 17 '15 at 15:08
  • I am running the open source version of Virtuoso. – tanktoo Oct 19 '15 at 08:59
  • Can you rebuild from current source 7.2.1 a/k/a 7.20.3214 ([stable](https://github.com/openlink/virtuoso-opensource/blob/stable/7/ChangeLog) or [develop](https://github.com/openlink/virtuoso-opensource/blob/develop/7/ChangeLog)) and test against that? A great many patches have been incorporated since Feburary! – TallTed Oct 20 '15 at 00:51
  • I have tested it with the new Virtuoso versions (stable and dev) and got the same results. I have added my Insert query to enable you to replay the problem. Thanks for your help! – tanktoo Oct 20 '15 at 08:44
  • I've brought this to the development team, and they're looking into it -- but I'm still wondering which "official forum" you're "not allowed to post in"... – TallTed Oct 21 '15 at 01:06
  • I mean the openlink forum. I got no mail after registration. Well the mail server sorted it into spam... but if you brought it to development team I think I don't have to post it again in the forum? – tanktoo Oct 21 '15 at 07:57
  • OK. Unfortunately, spam filters (over which we obviously have no control) aren't always accurate… and you *are* allowed to post to the official forums. It's not vital you repost this issue there, but it's certainly a better place for this product-specific, non-programming issue than SO, and I do recommend it for future. – TallTed Oct 21 '15 at 14:47
  • Well in the beginning I was unsure if this has definitely to do with the Virtuoso implementation of SPARQL. Thanks for your time! Will you keep me up to date regarding this issue? – tanktoo Oct 21 '15 at 16:05

1 Answers1

0

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.

tanktoo
  • 181
  • 12