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?

2
  • It's not quite clear what you're asking. Are you saying that you want to use property paths like ?a/has_stoptimes/rdfs:member? Nov 20, 2014 at 20:24
  • yes exactly sorry for my bad question.
    – madbitbot
    Nov 21, 2014 at 10:22

1 Answer 1

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 ] .
10
  • 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, 2014 at 12:10
  • What is the actual error message? Did you declare the appropriate prefix? Nov 21, 2014 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 <http://example.com> WHERE { ?b a <http://myrdf.com/Trip> . OPTIONAL { ?b <http://myrdf.com/has_stoptimes> ?t1 . ?t1 <http://www.w3.org/2000/01/rdf-schema#member> ?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, 2014 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
    – madbitbot
    Nov 21, 2014 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. Nov 21, 2014 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.