string compare in user defined rules

3 views
Skip to first unread message

bgad...@intec.ugent.be

unread,
Jan 30, 2014, 10:15:14 AM1/30/14
to sta...@clarkparsia.com
Hi,

I'm using stardog 2.0.3 and I've created some User defined rules.

[] a rule:SPARQLRule ;
        rule:content """
        PREFIX : <http://www.ugent.be/chest#>
        PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
        PREFIX xsd: <http://www.w3.org/2001/XMLSchema>
        IF {
                ?h a :Medication .
                ?h :hasPharmaGroup ?pg .
                FILTER(fn:contains(?pg,"Antibiotic"))
        }
        THEN {
                ?h a :AntibioticTreatment
        }
""" .

[] a rule:SPARQLRule ;
        rule:content """
        PREFIX : <http://www.ugent.be/chest#>
        PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
        PREFIX xsd: <http://www.w3.org/2001/XMLSchema>
        IF {
                ?h a :Medication .
                ?h :hasPharmaGroup ?pg .
                FILTER(fn:contains(?pg,"Antifungal"))
        }
        THEN {
                ?h a :AntifungalTreatment
        }
""" .

The idea is that stardog assigns a class AntifungalTreatment or AntibioticTreatment according to the value of the medications pharmagroup (Antibiotic or Antifungal).

Stardog howevers seems to assign both AntifungalTreatment and AntibioticTreatment to every medication with a pharmagroup of Antibiotic.

I've tried changing fn:contains(?pg,"Antibiotic") with ?pg = "Antibiotic" but this gives the same result.

Both classes AntifungalTreatment and AntibioticTreatment are defined disjoint in my ontology.

Executing the following SPARQL query (with reasoning level SL) results in the following output:

select * WHERE {?treatment a :Medication.  ?treatment rdf:type ?tp. ?treatment :hasPharmaGroup ?pg}

|                  treatment                   |          tp          |                           pg                            |
+----------------------------------------------+----------------------+---------------------------------------------------------+
| http://www.ugent.be/chest#Medication/1517791 | :Treatment           | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1517791 | :Medication          | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1517791 | owl:Thing            | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1517791 | :AntifungalTreatment | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1517791 | :AntibioticTreatment | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1519722 | :AntibioticTreatment | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1519722 | :AntifungalTreatment | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1519722 | owl:Thing            | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1519722 | :Treatment           | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |
| http://www.ugent.be/chest#Medication/1519722 | :Medication          | "Antibiotic"^^<http://www.w3.org/2001/XMLSchema#string> |


Can anyone explain this behaviour?

With kind regards
Bram

Mike Grove

unread,
Jan 30, 2014, 10:26:39 AM1/30/14
to stardog
Can you please provide the data?

Thanks.

Mike
 

With kind regards
Bram

--
-- --
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

Message has been deleted

Kendall Clark

unread,
Jan 30, 2014, 10:38:35 AM1/30/14
to stardog
You can use Stardog's obfuscation tool:


Cheers,
Kendall


On Thu, Jan 30, 2014 at 10:33 AM, <bgad...@intec.ugent.be> wrote:
The data itself is a problem. It is medical data so I can not disclose that.

I've attached my ontology and ICV rules file.

I hope this is ok?

Op donderdag 30 januari 2014 16:26:39 UTC+1 schreef Michael Grove:

Evren Sirin

unread,
Jan 30, 2014, 11:00:46 AM1/30/14
to Stardog
Or you can put together minimal data (couple triples might be enough
here) that demonstrates the problem. For example, I put the following
two triples into the database along with your rules and ontology but
did not get the inference for antifungal:

<http://www.ugent.be/chest#Medication/1517791> a
<http://www.ugent.be/chest#Medication> .
<http://www.ugent.be/chest#Medication/1517791>
<http://www.ugent.be/chest#hasPharmaGroup> "Antibiotic" .

So there are probably other things in your data that causes the inference.

Best,
Evren
Reply all
Reply to author
Forward
0 new messages