@prefix dash: <http://datashapes.org/dash#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix dctype: <http://purl.org/dc/dcmitype/> .
@prefix vann: <http://purl.org/vocab/vann/> .
@prefix sarefsh: <https://saref.etsi.org/shape#> .
@prefix schema: <http://schema.org/> .

sarefsh:OntologyShape
  a sh:NodeShape ;
    sh:targetClass dctype:Dataset ;
  sh:property sarefsh:conformsTo1 , sarefsh:conformsTo2 , sarefsh:conformsTo3 ;
  sh:property sarefsh:title1 , sarefsh:title2 , sarefsh:title3 ;
  sh:property sarefsh:abstract1 ;
  sh:property sarefsh:description1 , sarefsh:description2 ;
  sh:property sarefsh:license .

sarefsh:conformsTo1
  sh:severity sh:Violation ;
  sh:not sarefsh:conformsToNot2 .
sarefsh:conformsToNot2 sh:path dcterms:conformsTo ;
     sh:not sarefsh:conformsToNot .

sarefsh:conformsTo2
  sh:severity sh:Violation ;
  sh:path dcterms:conformsTo ;
  sh:not [ sh:pattern "^https://saref.etsi.org/(core|saref4[a-z]{4})/$" ] .

sarefsh:conformsTo3 sh:path dcterms:conformsTo ;
  sh:nodeKind sh:IRI ;
  sh:severity sh:Info ;
  sh:maxCount 0 .


sarefsh:title1 sh:path dcterms:title ;
  sh:severity sh:Violation ;
  sh:minCount 1 ;
  sh:severity sh:Warning .

sarefsh:title2 sh:path dcterms:title ;
  sh:severity sh:Violation ;
  sh:nodeKind sh:Literal ;
  sh:or (
    [ sh:datatype rdf:langString ]
    [ sh:datatype xsd:string ] ) .

sarefsh:title3
  sh:severity sh:Warning ;
  sh:not [
     sh:path dcterms:title ;
     sh:not [ sh:languageIn ( "en" ) ] ] .

sarefsh:abstract1 sh:path dcterms:abstract ;
  sh:severity sh:Violation ;
  sh:nodeKind sh:Literal ;
  sh:or (
    [ sh:datatype rdf:langString ]
    [ sh:datatype xsd:string ] 
    [ sh:datatype <https://www.iana.org/assignments/media-types/text/html> ] 
    [ sh:datatype <https://www.iana.org/assignments/media-types/text/markdown> ] 
  ) .

sarefsh:description1 sh:path dcterms:description ;
  sh:minCount 1 ;
  sh:severity sh:Warning .

sarefsh:description2 sh:path dcterms:description ;
  sh:severity sh:Violation ;
  sh:nodeKind sh:Literal ;
  sh:or (
    [ sh:datatype rdf:langString ]
    [ sh:datatype xsd:string ] 
    [ sh:datatype <https://www.iana.org/assignments/media-types/text/html> ] 
    [ sh:datatype <https://www.iana.org/assignments/media-types/text/markdown> ] 
  ) .

sarefsh:license sh:path dcterms:license ;
  sh:minCount 1 ;
  sh:maxCount 1 ;
  sh:nodeKind sh:IRI .