首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用SHACL验证json-ld 1.1数据图?

如何使用SHACL验证json-ld 1.1数据图?
EN

Stack Overflow用户
提问于 2019-10-24 21:53:58
回答 1查看 307关注 0票数 0

数据图:(json-ld)

代码语言:javascript
复制
{
    "@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"
}

.ttl格式的数据图表:

代码语言:javascript
复制
@prefix activity: <https://raw.githubusercontent.com/ReproNim/schema-standardization/master/activities/> .
@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 xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix reproterms: <https://raw.githubusercontent.com/ReproNim/schema-standardization/master/terms/> .
@prefix activity: <https://raw.githubusercontent.com/ReproNim/schema-standardization/master/activities/> .
@prefix reproschema: <https://raw.githubusercontent.com/ReproNim/schema-standardization/master/schemas/> .

activity:PHQ-9/phq9_schema
    a reproschema:Activity ;
    skos:prefLabel "PHQ-9 Assessment" .

形状图表:

代码语言:javascript
复制
@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 ;
    ] .

如果上下文包含@version: 1.1,则它似乎无法工作;会给出一个错误。如何对用JSON-LD1.1表示的图进行验证?我也添加了海龟格式的数据图表。

EN

回答 1

Stack Overflow用户

发布于 2019-10-26 10:11:26

约束sh:datatype rdf:langString要求属性的所有值都有一个language标记。例如,skos:prefLabel "PHQ-9评估“@en就可以了。或者将约束更改为sh:datatype xsd:string。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58542936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档