Examples from the lectures

From info216
Revision as of 18:58, 1 March 2023 by Sinoa (talk | contribs)

S07: SHACL

The examples are for use with the interactive SHACL Playground.

Full example

Final shape graph:

@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix dcterm: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix kg: <http://i2s.uib.no/kg4news/> .
@prefix th: <http://i2s.uib.no/kg4news/theme/> .
@prefix ss: <http://semanticscholar.org/> .


kg:MainPaperShape
    a sh:NodeShape ;
    sh:targetClass kg:MainPaper ;
    sh:property kg:YearShape, kg:ContributorShape .

kg:YearShape
        sh:path kg:year ;
        sh:minCount 1 ;
        sh:maxCount 1 ;
        sh:datatype xsd:year .

kg:ContributorShape
        sh:path dcterm:contributor ;
        sh:minCount 1 ;
        sh:class kg:MainAuthor ;
        sh:nodeKind sh:IRI .

Final data graph:

@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix dcterm: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix kg: <http://i2s.uib.no/kg4news/> .
@prefix th: <http://i2s.uib.no/kg4news/theme/> .
@prefix ss: <http://semanticscholar.org/> .


kg:LOD_Paper
    a kg:MainPaper ;
    dcterm:title "Linked Data - The Story so Far" ;
    kg:year "2006"^^xsd:year ;
    dcterm:contributor kg:TBL, kg:CB .

kg:TBL
    a kg:MainAuthor;
    foaf:name "T. Berners-Lee" .
 
kg:CB
     a kg:MainAuthor;
     foaf:name "C. Bizer" .