DaniFdezAlvarez / shexer

Apache License 2.0
26 stars 2 forks source link

Replace IRIs in triple constraints with shapes #121

Closed andrawaag closed 11 months ago

andrawaag commented 1 year ago

I am adapting the shex generated with sheXer as follows

wp:participants IRI ; # 100.0 %

100.0 % obj: @:DataNode. Cardinality: {1}

     # 95.91836734693877 % obj: @:Metabolite. Cardinality: {1}
     # 4.081632653061225 % obj: @:Protein. Cardinality: {1}

to

wp:participants @:DataNode or @:Metabolite @:Protein ; # 100.0 %

100.0 % obj: @:DataNode. Cardinality: {1}

     # 95.91836734693877 % obj: @:Metabolite. Cardinality: {1}
     # 4.081632653061225 % obj: @:Protein. Cardinality: {1}

is there a way sheXer can replace that IRI with those shapes?

DaniFdezAlvarez commented 1 year ago

@andrawaag , now sheXer will behave as you asked for that example. You only have to set disable_or_statements=False when you build the Shaper object, and that output will be generated.

But OR statements like the one of your example will only be extracted if the ratio of the most frequent node type (in your example, :DataNode with 100% complyance) is equal to the ratio of the macro IRI (which is also 100% in your example).

Otherwhise, shexer will still use IRI in the actual constraint and attach comments about more precise node types to the triple constraint.

Is this what you expected to happen?