SHACL rule on Ontology node?

18 views
Skip to first unread message

Rob Atkinson

unread,
Sep 11, 2019, 4:02:01 AM9/11/19
to TopBraid Suite Users
Hi

trying to execute a SHACL rule that preserves all the triples during a replace _except_ the ontology object and its properties

This gives me the expected results when executed against the target graph..

CONSTRUCT {
    ?s ?p ?o
}
WHERE { ?this a owl:Ontology .
    ?s ?p ?o FILTER ( ?s != ?this )
}

but when I run it as a SHACL rule as below it returns nothing - other rules are running OK..

is there some internal logic that stops it looking at owl:Ontology nodes when executing rules?  (or a better way of doing this : noting I have a "replace=true" on rule execution because normally i want to, this is a rule i want to use to override that behaviour )

:copy_graph
  rdf:type sh:NodeShape ;
  rdfs:label "copy original graph" ;
  sh:targetClass owl:Ontology ;
  sh:rule :SPARQLRule_1 ;
.


:SPARQLRule_1
  rdf:type sh:SPARQLRule ;
  rdfs:label "copy original graph" ;
  sh:construct """CONSTRUCT {
    ?s ?p ?o
}
WHERE {
    ?s ?p ?o FILTER ( ?s != ?this )
}""" ;
.

Holger Knublauch

unread,
Sep 11, 2019, 6:16:09 AM9/11/19
to topbrai...@googlegroups.com

I cannot think of a reason. How are you executing these rules? I tried a similar rule from TBC, but the example with ?s ?p ?o is of course hard to debug because all these triples are already there. Did you try a variation where ?o is a constant just to verify the particular rule actually fires?

Holger

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/e90378c0-5f5a-4d6d-9567-c5bcdfbe4de8%40googlegroups.com.

Holger Knublauch

unread,
Sep 11, 2019, 6:16:14 AM9/11/19
to topbrai...@googlegroups.com

I cannot think of a reason. How are you executing these rules? I tried a similar rule from TBC, but the example with ?s ?p ?o is of course hard to debug because all these triples are already there. Did you try a variation where ?o is a constant just to verify the particular rule actually fires?

Holger


On 11/09/2019 18:02, Rob Atkinson wrote:

dprice

unread,
Sep 11, 2019, 7:28:54 AM9/11/19
to topbrai...@googlegroups.com
If memory serves, I've run into this “cannot copy a triple” behaviour using SPIN and SHACL for ETL-style converters in the past.

Not 100% sure, but I think both SHACL and SPIN rule engines filter duplicate triples. 

As Holger suggested, hange the CONSTRUCT to make new triples. If you find it works , then it may be that ?s ?p ?o are not constructed because ?s ?p ?o already exists.

Cheers,
David

Rob Atkinson

unread,
Sep 11, 2019, 7:31:41 PM9/11/19
to TopBraid Suite Users
I apply with

 <sml:ApplySHACLRules sml:replace="true"  .

when I add a constant it doesnt throw anything up - so i still suspect there is logic not to apply to the ontology object -  could  it be excluded from the graph before application?

To unsubscribe from this group and stop receiving emails from it, send an email to topbrai...@googlegroups.com.

Holger Knublauch

unread,
Sep 11, 2019, 7:38:36 PM9/11/19
to topbrai...@googlegroups.com

I see no such code that would exclude the owl:Ontology, and the SM module doesn't even know the base URI of the input graph.

Could you send me (off-list) an export of the graph that serves as input (sml:ExportToRDFFile), and the relevant shapes file(s) so that I can run this through a debugger?

Thanks
Holger

To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/78abf4b5-00f8-45f4-aa72-48a53944dfa3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages