DaniFdezAlvarez / shexer

Apache License 2.0
26 stars 2 forks source link

SHACL example procudes error #118

Closed coret closed 2 years ago

coret commented 2 years ago

When running the example shown on the projectpage, the ShEx example produces a ShEx file as output. The SHACL example

# Use the same imports and param definition of the previous example code

output_file = "shaper_example.ttl"

shaper.shex_graph(output_file=output_file,
                  acceptance_threshold=0.1,
                  output_format=SHACL_TURTLE)

print("Done!")

produces an error:

Traceback (most recent call last):
  File "/home/db/shexer/ex2.py", line 50, in <module>
    shaper.shex_graph(output_file=output_file,
  File "/usr/local/lib/python3.9/dist-packages/shexer/shaper.py", line 207, in shex_graph
    return serializer.serialize_shapes()  # If string return is active, returns string.
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 67, in serialize_shapes
    self._add_shapes()
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 109, in _add_shapes
    self._add_shape(a_shape)
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 116, in _add_shape
    self._add_shape_constraints(shape=shape,
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 127, in _add_shape_constraints
    self._add_constraint(statement=a_statement,
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 138, in _add_constraint
    self._add_regular_constraint(statement=statement,
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 168, in _add_regular_constraint
    self._add_node_type(statement=statement,
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 241, in _add_node_type
    self._add_dataType_literal(r_constraint_node=r_constraint_node,
  File "/usr/local/lib/python3.9/dist-packages/shexer/io/shacl/formater/shacl_serializer.py", line 219, in _add_dataType_literal
    raise ValueError("Check here:" + target_type)
ValueError: Check here:http://www.w3.org/2001/XMLSchema#int
DaniFdezAlvarez commented 2 years ago

There is indeed a bug due to some debigging code. I´ll release a new version fixing it soon

DaniFdezAlvarez commented 2 years ago

@coret , this issue has been fixed in the release 2.0.1