Creating SHACL shapes from OWL

47 views
Skip to first unread message

Rob Atkinson

unread,
May 20, 2020, 1:50:48 AM5/20/20
to TopBraid Suite Users
A number of questions about the process of enabling EDG functions that rely on shapes

A general question is what EDG functions and editor components need shapes to work properly  - GraphQL for sure, Search (?)  - Classes and instances dont seem to need to to display, but editing needs property shapes?

To the point - trying to experiment keeps running into dead-ends.

I have a small ontology with nothing remotely fancy. It works well enough in the Classes and Instances view in EDG (as long as data is present in graph, not in a include).

If I use TBC to generate shapes it throws a Null  Pointer Error and creates a shapes graph with no shapes in it. (this seems to happen to about 50% of ontologies i try with this - most of them being externally source standard ontologies)
There is no further clue - there is a dialog but cant get any details beacuse another dialog comes up with "conversion successful" and if you dismiss that the error goes away too. No error is in the Error log, so cant access it that way.

I'm guessing this is not the preferred way of doing this any more..

If i load the Ontology in EDG, importing via owk:imports into an empty Ontology project - then run the Transform/ConvertOWL to SHACL it creates a whole bunch of cruft like:

 sh:PrefixDeclaration  rdf:type  sh:NodeShape ;
        sh:property  _:b38 ;
        sh:property  _:b39 .

i.e. its applying the rules to stuff i guess comes from   owl:imports  <http://topbraid.org/teamworkconstraints> ;   

this doenst seem terribly useful behaviour.

If I import the owl2shacl.ttl and the ontology into a new graph in TBC and run inferencing I get a different set of largely irrelevanty shapes derived from the owl2shacl.ttl itself.

So thats three different approaches - none of which generate shapes for just the ontology, and my EDG environment is still waiting for a solution before i can even see if it will play nice if it gets the shapes...

in the past I've manually created shapes I need - but I'm over that.






Richard Cyganiak

unread,
May 20, 2020, 2:35:37 AM5/20/20
to topbraid-users list


> On 20 May 2020, at 06:50, Rob Atkinson <robatki...@gmail.com> wrote:
>
> A general question is what EDG functions and editor components need shapes to work properly - GraphQL for sure, Search (?) - Classes and instances dont seem to need to to display, but editing needs property shapes?

Basically, “everything”.

Most importantly, the Form panel needs property shapes to display property values.

> I have a small ontology with nothing remotely fancy. It works well enough in the Classes and Instances view in EDG (as long as data is present in graph, not in a include).
>
> If I use TBC to generate shapes it throws a Null Pointer Error and creates a shapes graph with no shapes in it. (this seems to happen to about 50% of ontologies i try with this - most of them being externally source standard ontologies)
> There is no further clue - there is a dialog but cant get any details beacuse another dialog comes up with "conversion successful" and if you dismiss that the error goes away too. No error is in the Error log, so cant access it that way.

Okay. We test this feature with various examples and I have not seen this happen. Ontologies being what they are, our tests can cover only a selection of the possible cases. So sometimes there are bugs.

Can you share your ontology, or better yet, reduce it to a minimal example that triggers the problem, so that we can investigate, fix any bugs for the next release, and perhaps advice on what specifically triggers the bug in the current release?

> If i load the Ontology in EDG, importing via owk:imports into an empty Ontology project - then run the Transform/ConvertOWL to SHACL it creates a whole bunch of cruft like:
>
> sh:PrefixDeclaration rdf:type sh:NodeShape ;
> sh:property _:b38 ;
> sh:property _:b39 .
>
> i.e. its applying the rules to stuff i guess comes from owl:imports <http://topbraid.org/teamworkconstraints> ;

Which version of EDG is this? In 6.3.2, “Convert OWL Axioms to SHACL Constraints” creates URIs for property shapes and not blank nodes as shown in your snippet, so I'm confused as to what steps exactly you took.

Richard

Irene Polikoff

unread,
May 20, 2020, 2:52:53 AM5/20/20
to topbrai...@googlegroups.com
+1.

I have run conversions of different ontologies from different sources and never experienced any of these problems. We would need an example to figure this out.

> On May 20, 2020, at 2:35 AM, Richard Cyganiak <ric...@topquadrant.com> wrote:
>
>
>
>> On 20 May 2020, at 06:50, Rob Atkinson <robatki...@gmail.com> wrote:
>>
>> A general question is what EDG functions and editor components need shapes to work properly - GraphQL for sure, Search (?) - Classes and instances dont seem to need to to display, but editing needs property shapes?
>
> Basically, “everything”.
>
> Most importantly, the Form panel needs property shapes to display property values.

You need SHACL for all asset collection types except for ontologies themselves..
>
>> I have a small ontology with nothing remotely fancy. It works well enough in the Classes and Instances view in EDG (as long as data is present in graph, not in a include).
>>
>> If I use TBC to generate shapes it throws a Null Pointer Error and creates a shapes graph with no shapes in it. (this seems to happen to about 50% of ontologies i try with this - most of them being externally source standard ontologies)
>> There is no further clue - there is a dialog but cant get any details beacuse another dialog comes up with "conversion successful" and if you dismiss that the error goes away too. No error is in the Error log, so cant access it that way.
>
> Okay. We test this feature with various examples and I have not seen this happen. Ontologies being what they are, our tests can cover only a selection of the possible cases. So sometimes there are bugs.
>
> Can you share your ontology, or better yet, reduce it to a minimal example that triggers the problem, so that we can investigate, fix any bugs for the next release, and perhaps advice on what specifically triggers the bug in the current release?
>
>> If i load the Ontology in EDG, importing via owk:imports into an empty Ontology project - then run the Transform/ConvertOWL to SHACL it creates a whole bunch of cruft like:
>>
>> sh:PrefixDeclaration rdf:type sh:NodeShape ;
>> sh:property _:b38 ;
>> sh:property _:b39 .
>>
>> i.e. its applying the rules to stuff i guess comes from owl:imports <http://topbraid.org/teamworkconstraints> ;
>
> Which version of EDG is this? In 6.3.2, “Convert OWL Axioms to SHACL Constraints” creates URIs for property shapes and not blank nodes as shown in your snippet, so I'm confused as to what steps exactly you took.

I have not seen it generate anything for the system ontologies such as <http://topbraid.org/teamworkconstraints>.

On the Transform tab, you get to select which of the owl imported graphs should be processed as part of this transformation. If you do not select any of the imported graphs, the transformation will run only for the classes that are located directly in the ontology i.e., the local content.

>
> Richard
>
> --
> 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/60C72962-5DD8-467B-8A49-AE08F6B8EFF6%40topquadrant.com.

Rob Atkinson

unread,
May 20, 2020, 3:47:32 AM5/20/20
to TopBraid Suite Users

> Can you share your ontology, or better yet, reduce it to a minimal example that triggers the problem, so that we can investigate, fix any bugs for the next release, and perhaps advice on what specifically triggers the bug in the current release?
>
will do via email.  This is an ontology that seems OK in EDG but crashed TBC


>> If i load the Ontology in EDG, importing via owk:imports into an empty Ontology project - then run the Transform/ConvertOWL to SHACL it creates a whole bunch of cruft like:
>>
>> sh:PrefixDeclaration  rdf:type  sh:NodeShape ;
>>        sh:property  _:b38 ;
>>        sh:property  _:b39 .
>>
>> i.e. its applying the rules to stuff i guess comes from   owl:imports  <http://topbraid.org/teamworkconstraints> ;  
>
> Which version of EDG is this? In 6.3.2, “Convert OWL Axioms to SHACL Constraints” creates URIs for property shapes and not blank nodes as shown in your snippet, so I'm confused as to what steps exactly you took.

6.3.2

OK - this is based on exporting TTL and inspecting it - its picked up stuff from imports - if I open the Repository and look at triples without the imports these node shapes arent there. I didnt expect the TTL export to include both an owl:imports statement and all the imported statements...



 
I have not seen it generate anything for the system ontologies such as <http://topbraid.org/teamworkconstraints>.

On the Transform tab, you get to select which of the owl imported graphs should be processed as part of this transformation. If you do not select any of the imported graphs, the transformation will run only for the classes that are located directly in the ontology i.e., the local content.


That if you use the Execute rules - if you go into an ontology there are two links "all" and "none" - and nothing appears to happen if you click either. 

I think its working just fine and I was just confused by the export. 

If I temporarily import owl2shacl and execute on Ontology asset collection creation it seems to work too. I just need to save these to a shapes ttl.
 
>
> Richard
>
> --
> 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 topbrai...@googlegroups.com.

Richard Cyganiak

unread,
May 20, 2020, 4:12:28 AM5/20/20
to topbraid-users list

On 20 May 2020, at 08:47, Rob Atkinson <robatki...@gmail.com> wrote:


> Can you share your ontology, or better yet, reduce it to a minimal example that triggers the problem, so that we can investigate, fix any bugs for the next release, and perhaps advice on what specifically triggers the bug in the current release?
>
will do via email.  This is an ontology that seems OK in EDG but crashed TBC

Got it, thanks, will investigate.

>> If i load the Ontology in EDG, importing via owk:imports into an empty Ontology project - then run the Transform/ConvertOWL to SHACL it creates a whole bunch of cruft like:
...

> Which version of EDG is this? In 6.3.2, “Convert OWL Axioms to SHACL Constraints” creates URIs for property shapes and not blank nodes as shown in your snippet, so I'm confused as to what steps exactly you took.

6.3.2

OK - this is based on exporting TTL and inspecting it - its picked up stuff from imports - if I open the Repository and look at triples without the imports these node shapes arent there. I didnt expect the TTL export to include both an owl:imports statement and all the imported statements...

This is the Turtle export on the Export tab of the asset collection? That doesn't include triples from owl:imported graphs. I use that frequently as a way of finding out what triples are in the asset collection's master graph.

Richard

Rob Atkinson

unread,
May 20, 2020, 10:40:18 PM5/20/20
to TopBraid Suite Users

OK - this is based on exporting TTL and inspecting it - its picked up stuff from imports - if I open the Repository and look at triples without the imports these node shapes arent there. I didnt expect the TTL export to include both an owl:imports statement and all the imported statements...

This is the Turtle export on the Export tab of the asset collection? That doesn't include triples from owl:imported graphs. I use that frequently as a way of finding out what triples are in the asset collection's master graph.


Me too - but I have sussed it out - I am including owl2shacl then running apply shacl rules over graph with imports - which I need to do because the asset collection is a wrapper around the original ontology (separate thread about this pattern) - and owl2shacl is including itself and all the teamwork stuff the asset collection needs to include in the processing ..

Looks like I need to use the optional shapesGraph argument in ApplySHACL instead of having it in include, and perform extra logic to generate a union of all the shapes I need to apply, or loop if i can work out what order they need to be applied.)

 
Richard

Irene Polikoff

unread,
May 21, 2020, 12:07:06 AM5/21/20
to topbrai...@googlegroups.com

On May 20, 2020, at 10:40 PM, Rob Atkinson <robatki...@gmail.com> wrote:


OK - this is based on exporting TTL and inspecting it - its picked up stuff from imports - if I open the Repository and look at triples without the imports these node shapes arent there. I didnt expect the TTL export to include both an owl:imports statement and all the imported statements...

This is the Turtle export on the Export tab of the asset collection? That doesn't include triples from owl:imported graphs. I use that frequently as a way of finding out what triples are in the asset collection's master graph.


Me too - but I have sussed it out - I am including owl2shacl then running apply shacl rules over graph with imports - which I need to do because the asset collection is a wrapper around the original ontology (separate thread about this pattern) - and owl2shacl is including itself and all the teamwork stuff the asset collection needs to include in the processing ..


You do not need to include owl2shacl.

For example, create a new ontology in EDG.

Include in it some RDFS/OWL file. For example:

<urn:x-evn-master:test_ontology>
  a teamwork:Vocabulary ;
  a owl:Ontology ;
  metadata:status metadata:UnderDevelopmentStatus ;
  rdfs:label "Test Ontology" ;
.

Go to Transform tab.


Select the included wgspos84 ontology

Click transform, the following service is executed


And you get



Looks like I need to use the optional shapesGraph argument in ApplySHACL instead of having it in include, and perform extra logic to generate a union of all the shapes I need to apply, or loop if i can work out what order they need to be applied.)

 
Richard

--
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/f891a4fb-15ce-483f-88ba-a0ce310169ec%40googlegroups.com.

Rob Atkinson

unread,
May 21, 2020, 1:54:40 AM5/21/20
to TopBraid Suite Users

In general using the UI isnt an option for data management in the sort of systems we need - but as mentioned I do now know how to recreate the service functions so i dont need to include it. Should be good to go play with that. 

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

Irene Polikoff

unread,
May 21, 2020, 2:44:06 AM5/21/20
to topbrai...@googlegroups.com
I posted the service URL so that you could look at the SWP service that performs the conversion. I think all you need to do is call it and provide the parameters:

&projectGraph - EDG ontology


&graphs - this is where you provide the URIs of the underlying graphs that you are “wrapping” and want to generate shapes from

You do not need to include the OWL2SHAL rules in the EDG ontology. This service already knows what to do.

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/027657e1-43d4-46e1-bf23-e3e1be2b4afc%40googlegroups.com.

Rob Atkinson

unread,
May 21, 2020, 6:28:22 AM5/21/20
to TopBraid Suite Users
Thanks for the details - I'm sure it will be useful for testing things and for anyone finding this thread.

 As I already have SWP code that marshalls multiple entailment rules (as shapes) , and owl2shacl is just one piece of the puzzle, i think I just need to create a union and feed into the shapesGraph param instead of doing a union with the main graph. 
Reply all
Reply to author
Forward
0 new messages