imas/rdflint

add shacl comment to shacl violation message

Opened this issue · 0 comments

現状のメッセージは汎用的な内容なので、
その制約がある背景なども分かるように、対応するShapeのコメントを出力するとわかりやすいと思われる。
(im@sparqlの場合、Shapeのrdfs:comment,rdfs:labelに説明があるので)

現状のメッセージの例

SHACLで定義された制約に違反しています: "Value has 2 shapes out of 2 in the sh:xone enumeration" (http://www.w3.org/ns/shacl#XoneConstraintComponent) (line: 37, col: 1, triple: https://sparql.crssnky.xyz/imasrdf/RDFs/detail/Amami_Haruka - http://xmlns.com/foaf/0.1/age - "-17"^^http://www.w3.org/2001/XMLSchema#integer)

対応するShape

imas-shape:IdolShape a sh:NodeShape;
    sh:targetClass imas:Idol;
    sh:property [
        rdfs:label "年齢の制約";
        rdfs:comment "何人かのアイドルは年齢が数値じゃない";
        sh:path foaf:age;
        sh:xone (
            [
                sh:datatype xsd:integer;
                sh:minInclusive 0;
            ]
            [
                sh:datatype rdf:langString;
                sh:languageIn ("ja")
            ]
        );
        sh:maxCount 1;
    ];