Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when asking for table output in CLI #145

Open
RiX012 opened this issue Jun 14, 2022 · 3 comments
Open

Errors when asking for table output in CLI #145

RiX012 opened this issue Jun 14, 2022 · 3 comments

Comments

@RiX012
Copy link

RiX012 commented Jun 14, 2022

All goes well until i ask for table output. Error message:

PS C:\GitHub\imbor> pyshacl -s "C:\GitHub\imbor\docs\uitwisseling_rdf\files\temp\shapes.ttl" -i rdfs -a -f table "C:\GitHub\imbor\docs\uitwisseling_rdf\files\temp\data.ttl"
+----------+
| Conforms |
+----------+
|  False   |
+----------+

Traceback (most recent call last):
  File "C:\Users\100288\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\100288\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\100288\AppData\Local\Programs\Python\Python310\Scripts\pyshacl.exe\__main__.py", line 7, in <module>
  File "C:\Users\100288\AppData\Local\Programs\Python\Python310\lib\site-packages\pyshacl\cli.py", line 285, in main
    r[SH.resultMessage],
KeyError: rdflib.term.URIRef('http://www.w3.org/ns/shacl#resultMessage')

I am not a coder, just trying to use the validator. What is wrong here?

@ashleysommer
Copy link
Collaborator

Hi @RiX012
Thanks for the report. The Table output is a relatively new feature in PySHACL, and it hasn't had much real-world testing.
I can see where the problem lies, the table generator expects the SHACL constraint to define a sh:message, and it wants to print the message in the table. But in your case, where the shape's constraint does not have a message, the table generator fails. I can put a fix in the next release to address it.

Just out of curiosity, are you able to show the contents of your shapes.ttl file that you're using here? Most SHACL constraints have a default message built in, so I'd like to see which constraints you are using to see if I can add in another default message somewhere.

@ashleysommer
Copy link
Collaborator

@RiX012
This is now fixed in new release v0.19.1

@RiX012
Copy link
Author

RiX012 commented Jun 30, 2022

Just out of curiosity, are you able to show the contents of your shapes.ttl file that you're using here? Most SHACL constraints have a default message built in, so I'd like to see which constraints you are using to see if I can add in another default message somewhere.

Thanks for fixing so fast. Works perfect now! No problem sharing:

@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix sh:    <http://www.w3.org/ns/shacl#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix def:   <http://example.org/def/> .
@prefix nen2660: <https://w3id.org/nen2660/def#> .

def: a owl:Ontology .

nen2660:hasPart
  a owl:ObjectProperty ;
.

nen2660:RealObject
  a sh:NodeShape, owl:Class ;
  sh:property [
      sh:path nen2660:hasPart ;
	  sh:class nen2660:RealObject 
    ] ;
.

def:Car
        rdf:type            sh:NodeShape , owl:Class ;
		rdfs:subClassOf		nen2660:RealObject ;
		sh:property  [ sh:path  nen2660:hasPart ;
						sh:qualifiedMinCount 1 ;
						sh:qualifiedMaxCount 1 ;
						sh:qualifiedValueShape [ sh:class def:Wheel ] ;
						] ;
.

def:Wheel
        rdf:type            sh:NodeShape , owl:Class .

def:Door
        rdf:type            sh:NodeShape , owl:Class .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants