0

I have create an endpoint SPAQL on OpenLink Virtuoso. All work well, but i have to access on the data in a Container, in particular a rdf:Seq.

I have a Seq like this:

 <myrdf:has_stoptimes>
  <rdf:Seq rdf:about="http://test.com/343">
    <rdf:li>
      <myrdf:StopTime rdf:about="http://test.com/StopTime/434">
           ...
      </ns0:StopTime>
    </rdf:li>
    <rdf:li>
      <myrdf:StopTime rdf:about="http://test.com/StopTime/435">
           ...
      </ns0:StopTime>
    </rdf:li>
  </rdf:Seq>

Now i see that to access data in a container i can use rdfs:member or FILTER (strstarts(str(?prop), str(rdf:_)) how is explained here

But for my project i have to adopt the first solution because i'm working with Silk and i will use the code syntax like ?a/myrdf:has_stoptimes/rdfs:member without use of "complex" filter.

I have tried to follow this guide but querying the endpoint nothing work how i hoped.

So my question is: how can i query ?a/myrdf:has_stoptimes/rdfs:member on a Virtuoso endpoint SPARQL?Which inference rule i have to add in endpoint SPARQL?

Thank you in advance


UPDATE

I have created the following inference rules in Virtuoso:

ttlp (' @prefix rdfs:  .
        @prefix rdf:  .
  rdfs:Container rdf:type rdfs:Class ; rdfs:subClassOf rdfs:Resource .
  rdfs:ContainerMembershipProperty a rdfs:Class ; rdfs:subClassOf rdf:Property .
  rdf:Seq rdf:type rdfs:Class ; rdfs:subClassOf rdfs:Container .
  rdfs:member rdf:type rdf:Property ; rdfs:domain rdfs:Resource ; rdfs:range rdfs:Resource .
  ', '', 'http://localhost:8890/schema/test') ;

Nothing work querying the SPARQL endpoint like:

define input:inference "http://localhost:8890/schema/property_rules1"

       SELECT *
        FROM 
        WHERE {?sep a rdf:Seq.
        ?seq rdfs:member ?p}

After i tried adding the follow line to the ttl file: rdf:_1 rdfs:subPropertyOf rdfs:member . In this way it work but obviously the results are only for the first element of the container. So is very unconvenient add a line for all of rdf:_n, and i think this is only a temporary solution, it is not correct.

I have tried to add an RDF dump on SILK 2.6.1, and on the section SPARQL of the data source if i run the query:

 SELECT *
    FROM 
    WHERE {?sep a rdf:Seq.
    ?seq rdfs:member ?p}

I obtain the correct result, without specify any inference rules. So i think that in this functionality of SILK there is something that i’m missing in my endpoint SPARQL or am i saying nonsense things?

Community
  • 1
  • 1
madbitbot
  • 1
  • 2

1 Answers1

0

You can't use variables in property paths, so you can't actually do

?x ?a/has_stoptimes/rdfs:member ?y

Instead, you have to use another variable or blank node in between:

?x ?a ?z . ?z has_stoptimes/rdfs:member ?y

?x ?a [ has_stoptimes/rdfs:member ?y ] .
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • but my problem is that the endpoint SPARQL that receive my query don't recognize `rdfs:member` property so i can't operate on node of the container (rdf:Seq) – madbitbot Nov 21 '14 at 12:10
  • What is the actual error message? Did you declare the appropriate prefix? – Joshua Taylor Nov 21 '14 at 12:13
  • yes all prefix are right, there aren't error messages. The problem is that my rdf has property like rdf:_1,rdf:_2..rdf:_n and the only way that i found to query via SPARQL the nodes of the rdf:Seq is through rdfs:member property. The SPARQL query generated by SILK is: `SELECT ?b ?v0 FROM WHERE { ?b a . OPTIONAL { ?b ?t1 . ?t1 ?v0 . }` So the problem is not SILK or its syntax because if i query directly on SPARQL endpoint via browser it don't work anyway. – madbitbot Nov 21 '14 at 12:48
  • i'm pretty sure that the problem is that i need to modify my endpoint SPARQL, like add inference rules but i don't know how, in particular which rule adds. I found an old document speaking about it but very generally [link old doc](http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2007Jun/0005.html) – madbitbot Nov 21 '14 at 12:52
  • Ah, OK. I see. Sorry, I misunderstood the issue. Would your data let you make the assumption that if something is a Seq, then all of its properties (aside from `rdf:type`) are `rdfs:_n` properties? Then you could simply search for `:seq789 ?p ?element`. – Joshua Taylor Nov 21 '14 at 13:33
  • I don't know because i'm not very expert of Virtuoso. But the main problem is that rdf:_1, rdf:_2...rdf:_n is not identifiable via SPARQL in a general way, i can only said `?s rdf:_1 ?o.` and this keep only the first element of a container. – madbitbot Nov 21 '14 at 16:09
  • right, and if you use rdfs:member, then you lose ordering information. But if the seq *only* has rdf:_n properties, then you could just ask for *all* the properties, and then you'd essentially be getting rdfs:member. – Joshua Taylor Nov 21 '14 at 16:18
  • yes sure but is here that enter Silk Framework because its [path input](https://www.assembla.com/wiki/show/silk/Path_Input) accept only property after `/` "forward operator" so i have to usa a property that is general because i can't use rdf:_1, how i explain before. I need to use rdfs:member and if i lose ordering information is not a problem here. – madbitbot Nov 21 '14 at 17:02
  • @madbitbot Are you trying to write a Silk query or a SPARQL query? The title asks about a SPARQL endpoint, and it sounds like the query is going to be run against a Virtuoso endpoint. Then you can either use the SPARQL query and filter for the `_n` properties, or you can ask for *any* property (if there shouldn't be any others). (All of those are options other than enabling RDFS inferencing.) – Joshua Taylor Nov 21 '14 at 20:08
  • Yes the query is going to be run on a SPARQL endpoint but it start from a query write in SILK, so i don't have the full expressivity of normal filter. Is for that i'm trying to found a solution about rdfs:member using inference rules. Besides i tried to load a rdf dump in silk and query on in through silk SPARQL view, and here rdfs:member work well!!! So i think that is really a problem with my Virtuoso SPARQL endpoint. – madbitbot Nov 22 '14 at 01:05