Querying over data properties whose values are determined by SWRL rules

2 views
Skip to first unread message

Ben Whittam Smith

unread,
Apr 3, 2014, 5:05:56 PM4/3/14
to sta...@clarkparsia.com
I'm using SWRL rules to 'translate' data properties so:

[] rdf:type rule:SPARQLRule ;
  rule:content """
    IF {
      ?product etilize:hasDVB-T 'DVB-T (MPEG4)'
    }
    THEN {
      ?product product:hasFreeview 'Freeview HD'
    }
  """.

  If I query directly on an individual (using SL reasoning) for the value of the translated property I get the expected result.

  query "productStore;reasoning=SL" "SELECT ?value WHERE { $id product:hasFreeview ?value}"

  However, if I query for all the data properties on the individual the 'translated' properties do not appear - only the original ones (eg. hasDVB-T).

  So: query "productStore;reasoning=SL" "SELECT ?dataprop ?value WHERE { $id ?dataprop ?value }"

  In fact, I really want to be running queries like this: query "productStore" "SELECT ?dataprop ?value WHERE { dataprop rdfs:subPropertyOf* product:hasUntestedDisplayProperties . $id ?dataprop ?value }"

  But as above, none of the 'translated' properties appear. How can I make them do so - or should I be taking another approach?

Héctor Pérez-Urbina

unread,
Apr 4, 2014, 8:58:54 AM4/4/14
to stardog
Hi Ben,

The type of the ?dataprop variable is ambiguous; that is, we don't have enough information to tell whether it is a data property, an object property, or even the special property rdf:type. When this happens, we log a warning and punt reasoning. Try adding the following triple pattern to your query: 

?dataprop a owl:DatatypeProperty.

As for the third query, the use of rdfs:subPropertyOf* is unnecessary as the SL reasoning level already handles role hierarchies. Something like 

{$id product:hasUntestedDisplayProperties ?value}

should suffice.


--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en



--
Best,
Héctor
Message has been deleted

benedict.wh...@which.co.uk

unread,
Apr 8, 2014, 10:27:18 AM4/8/14
to sta...@clarkparsia.com
Hi Héctor,

Many thanks for your reply.

I tried a naive implementation of your suggestion: query "hTest;reasoning=SL" "select distinct ?predicate ?object where { product:Samsung_UE40F6270 ?predicate ?object . ?predicate a owl:DatatypeProperty }"

But get the following result: value already present: -3

I've attached my test case.

On your suggestion of allowing SL reasoning to handle the hierarchy I was unable to get annotations returned on the child properties - or their parent properties. 

I'm using: "select distinct ?label ?dataprop ?description ?value ?unit ?groupname ?parentprop where { product:LG_47LM765S ?dataprop ?value . ?dataprop rdfs:subPropertyOf* product:hasUntestedDisplayProperties . ?dataprop rdfs:subPropertyOf ?parentprop. OPTIONAL { ?dataprop skos:prefLabel ?label } . OPTIONAL { ?dataprop terms:description ?description } . OPTIONAL { ?dataprop product:Units ?unit } . OPTIONAL { ?parentprop skos:prefLabel ?groupname } . FILTER (?parentprop != product:hasTelevisionProperties) }"

But I admit the query feels a little unwieldy. Would be great to lose the rdfs:subPropertyOf* and use reasoning to walk the hierarchy but can I do so and still return the annotations (and ?parentprop)?

Thanks,

Ben

CONFIDENTIAL NOTICE 
This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient please note that any distribution, copying or use of this communication or the information in it is strictly prohibited. If you received this communication in error, please notify us by e-mail or by telephone (020 7770 7000) and then delete the e-mail and any copies of it. (v.9)

Which? is the business name of Which? Limited, registered in England and Wales No. 677665. Registered office: 2 Marylebone Road, London NW1 4DF.
Etv-Products.owl
HierarchyTest.owl
TVSpecConversionRules.ttl

Héctor Pérez-Urbina

unread,
Apr 8, 2014, 10:33:21 AM4/8/14
to stardog
Thank you very much for the test cases. I will take a closer look and get back to you.


On Tue, Apr 8, 2014 at 9:56 AM, <benedict.wh...@which.co.uk> wrote:
Hi Héctor,

Many thanks for your reply.

I tried a naive implementation of your suggestion: query "hTest;reasoning=SL" "select distinct ?predicate ?object where { product:Samsung_UE40F6270 ?predicate ?object . ?predicate a owl:DatatypeProperty }"

But get the following result: value already present: -3

I've attached my test case.

On your suggestion of allowing SL reasoning to handle the hierarchy I was unable to get annotations returned on the child properties - or their parent properties. 

I'm using: "select distinct ?label ?dataprop ?description ?value ?unit ?groupname ?parentprop where { product:LG_47LM765S ?dataprop ?value . ?dataprop rdfs:subPropertyOf* product:hasUntestedDisplayProperties . ?dataprop rdfs:subPropertyOf ?parentprop. OPTIONAL { ?dataprop skos:prefLabel ?label } . OPTIONAL { ?dataprop terms:description ?description } . OPTIONAL { ?dataprop product:Units ?unit } . OPTIONAL { ?parentprop skos:prefLabel ?groupname } . FILTER (?parentprop != product:hasTelevisionProperties) }"

But I admit the query feels a little unwieldy. Would be great to lose the rdfs:subPropertyOf* and use reasoning to walk the hierarchy but can I do so and still return the annotations (and ?parentprop)?

Thanks,

Ben


On Friday, 4 April 2014 13:58:54 UTC+1, Hector Perez Urbina wrote:
CONFIDENTIAL NOTICE 
This communication contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient please note that any distribution, copying or use of this communication or the information in it is strictly prohibited. If you received this communication in error, please notify us by e-mail or by telephone (020 7770 7000) and then delete the e-mail and any copies of it. (v.9)

Which? is the business name of Which? Limited, registered in England and Wales No. 677665. Registered office: 2 Marylebone Road, London NW1 4DF.

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en



--
Best,
Héctor

Ben Whittam Smith

unread,
Apr 11, 2014, 8:15:09 AM4/11/14
to sta...@clarkparsia.com
Hi Héctor - have you had a chance to take a look at this?

Thanks,

Ben


To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

Héctor Pérez-Urbina

unread,
Apr 11, 2014, 9:39:43 AM4/11/14
to stardog
Hi Ben,

I've been busy this week doing training out of the office and I have a similar commitment for next week. I'll take a look when I come back.

If the matter is urgent, please take a look at our support plans [1].

Héctor Pérez-Urbina

unread,
Apr 18, 2014, 2:08:15 PM4/18/14
to stardog
Dear Ben,

I took a look at your issue. The problem is caused by a known limitation of how we handle unbound patterns with reasoning. I realize it's not great, but I'd suggest to keep the predicate bounded (no ?p) in the meantime. I'll be working on this particular bug next week.
--
Best,
Héctor
Reply all
Reply to author
Forward
0 new messages