w3c / data-shapes

RDF Data Shapes WG repo
87 stars 33 forks source link

How to validate json-ld 1.1 data graphs? #120

Closed sanuann closed 4 years ago

sanuann commented 4 years ago

Data Graph:

{
    "@context": {
       "@version": 1.1,
        "pav": "http://purl.org/pav/",
        "xsd": "http://www.w3.org/2001/XMLSchema#",
        "skos": "http://www.w3.org/2004/02/skos/core#",
        "reproterms": "https://raw.githubusercontent.com/ReproNim/schema-standardization/master/terms/",
        "reproschema": "https://raw.githubusercontent.com/ReproNim/schema-standardization/master/schemas/",
        "schema": "http://schema.org/",
        "@language": "en",
        "prefLabel": {
            "@id": "skos:prefLabel",
            "@container": "@language"
        }
    },
    "@type": "reproschema:Activity",
    "@id": "phq9_data",
    "prefLabel": "PHQ-9 Assessment"
}

Shapes Graph:

@prefix dash: <http://datashapes.org/dash#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <http://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix reproterms: <https://raw.githubusercontent.com/ReproNim/schema-standardization/master/terms/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix reproschema: <https://raw.githubusercontent.com/ReproNim/schema-standardization/master/schemas/> .

reproschema:ActivityShape
    a sh:NodeShape ;
    sh:targetClass reproschema:Activity;

    sh:property [
        sh:path skos:prefLabel ;
        sh:datatype rdf:langString ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
    ] .

if the context contains @version: 1.1 it doesn't seem to work. How to make it work?

HolgerKnublauch commented 4 years ago

GitHub issues here on the data-shapes W3C group should only be created for suspected problems with the SHACL specifications, not for how-to-use-SHACL questions. I am therefore closing this as off-topic, yet recommend that you post your question to either the SHACL Community group mailing list (https://www.w3.org/community/shacl/) or other public forums such as Stack overflow.

TallTed commented 4 years ago

@sanuann -- I suggest you edit your initial post here, to wrap the graphs in codefences, i.e., put a line with just three backticks (as below) before and after each graph --

```

This will stop signaling the people with GitHub handles matching your @Prefix and other @ objects getting alerts on this thread. It will also preserve whitespace and other characters which are currently being treated as Markdown tags.