linkml / linkml

Linked Open Data Modeling Language
https://linkml.io/linkml
Other
325 stars 101 forks source link

gen-shex throws error when slot name and class name are case-sensitive identical #991

Open cmungall opened 2 years ago

cmungall commented 2 years ago

It's necessary to make a slightly odd schema to replicate this:

id: http://example.org

classes:
  a:
    slots:
      - a
    slot_usage:
      a:
        range: a

slots:
  a:
    range: a

yields:

ValueError: Wrong type for shapeExprs: [Shape(type='Shape', id=None, extends=None, closed=True, extra=None, expression=EachOf(type='EachOf', id=None, expressions=[TripleConstraint(type='TripleConstraint', id='http://example.org/A_tes', inverse=None, predicate='http://example.org/a', valueExpr='http://example.org/A', min=0, max=1, onShapeExpression=None, semActs=None, annotations=None), TripleConstraint(type='TripleConstraint', id=None, inverse=None, predicate='http://www.w3.org/1999/02/22-rdf-syntax-ns#type', valueExpr=NodeConstraint(type='NodeConstraint', id=None, nodeKind=None, datatype=None, values=['http://example.org/A']), min=0, max=None, onShapeExpression=None, semActs=None, annotations=None)], min=None, max=None, semActs=None, annotations=None), semActs=None, annotations=None)] - expected: <class 'pyjsg.jsglib.jsg_array.shapeExprs'> got list

I think it's OK to explicitly reject the schema, as using case-identical slot and class names is likely to cause many issues in different places, but the error message should be more informative.

nlharris commented 3 months ago

Is this fixed? Is gen-shex still in use?

cmungall commented 3 months ago

yes, still in use: https://linkml.io/linkml/generators/shex.html

nlharris commented 10 hours ago

Is this now fixed?