@prefix xsd:	<http://www.w3.org/2001/XMLSchema#> .
@prefix rdf:	<http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:	<http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:    <http://www.w3.org/2002/07/owl#> .
@prefix sh: 	<http://www.w3.org/ns/shacl#> . 
@prefix shsh:   <http://www.w3.org/ns/shacl-shacl#> .

@prefix skos:	<http://www.w3.org/2004/02/skos/core#> .
@prefix pav:	<http://purl.org/pav/> .
@prefix dc:	<http://purl.org/dc/elements/1.1/> .
@prefix vs:     <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix vann:   <http://purl.org/vocab/vann/> .
@prefix foaf:   <http://xmlns.com/foaf/0.1/> .

@prefix imf-m: <https://ns.imfid.org/imf-m/id/> .
@prefix shp: <https://ns.imfid.org/imf-m/shapes/types-grammar#> .
@prefix ex:	<http://example.com#> .
@prefix pca-plm:    <http://rds.posccaesar.org/ontology/plm/rdl/> .
@prefix ottr:        <http://ns.ottr.xyz/0.4/> .
@prefix o-rdf:       <http://tpl.ottr.xyz/rdf/0.1/> .
@prefix o-rdfs:       <http://tpl.ottr.xyz/rdfs/0.2/> .
@prefix o-owl-ax:    <http://tpl.ottr.xyz/owl/axiom/0.1/> .
@prefix o-owl-ma:    <http://tpl.ottr.xyz/owl/macro/0.1/> .
@prefix o-owl-rstr:  <http://tpl.ottr.xyz/owl/restriction/0.1/> .
@prefix o-owl-dec:  <http://tpl.ottr.xyz/owl/declaration/0.1/> .



<https://ns.imfid.org/imf-m/shapes/types-grammar> a owl:Ontology ;
    owl:versionIRI <https://ns.imfid.org/imf-m/shapes/0.2.0/types-grammar> ;
    owl:versionInfo "0.2.0" ;
    skos:prefLabel "IMF Types Grammar -- SHACL" ;
    dc:description """
These SHACL Shapes specify requirements for creating IMF Types SHACL Shapes. This SHACL Shape file extends the W3C SHACL Shapes specification.

Use them to validate IMF Type SHACL Shapes.
""" ;
    pav:createdBy [ foaf:name "Martin G. Skjæveland" ] ;
    pav:createdOn "2023-06-30T00:00:00"^^xsd:dateTime ;
    owl:imports 
      <http://www.w3.org/ns/shacl-shacl#> ,
      <https://ns.imfid.org/imf-m/shapes/0.2.0/terms-grammar> ;
    sh:shapesGraph 
      <http://shipshape.dyreriket.xyz/std-vocabulary-elements.ttl> ,
      <http://www.w3.org/ns/shacl-shacl#> ;
    skos:editorialNote """Result of validation against specified sh:shapesGraph:
Result of validating RDF data <out/shacl/imf-types-grammar.shacl.ttl> against SHACL shape <http://shipshape.dyreriket.xyz/std-vocabulary-elements.ttl>:
2023-06-30
Conforms


Result of validating RDF data <out/shacl/imf-types-grammar.shacl.ttl> against SHACL shape <http://www.w3.org/ns/shacl-shacl#>:
2023-06-30
Conforms

    """
.

shp:TypeShape a sh:NodeShape ;
  sh:targetClass imf-m:BlockType , imf-m:TerminalType , imf-m:AttributeType ;
  sh:property 
    [ sh:path sh:targetClass ; sh:minCount 1 ; sh:message "The Type has no sh:targetClass." ] ,
    #[ sh:path sh:name ;        sh:minCount 1 ; sh:severity sh:Warning ; sh:message "A Type should specify a sh:name." ] ,
    #[ sh:path sh:description ; sh:minCount 1 ; sh:severity sh:Warning ; sh:message "A Type should specify a sh:description." ] ,

    [ sh:path sh:property ;
      sh:node [ sh:property [ sh:path [ sh:alternativePath ( sh:hasValue sh:in sh:node sh:datatype sh:class ) ] ; sh:minCount 1 ; sh:maxCount 1 ] ] ;
      sh:message "A property constraint must specify exactly one of the following: sh:hasValue, sh:in, sh:node, sh:class or sh:datatype." ]  ,

    [ sh:path sh:property;
      sh:node [ sh:property [ sh:path [ sh:alternativePath ( sh:hasValue sh:minCount ) ] ; sh:minCount 1 ; sh:maxCount 1 ] ] ;
      sh:message "A property constraint must specify exactly one of the following sh:hasValue or sh:minCount (which can be set to 0)." ] ,

    [ sh:path sh:property;
      sh:node [ sh:or ( # A -> B  =  not A or B
          [ sh:not [ sh:path [ sh:alternativePath ( sh:minExclusive sh:maxExclusive sh:minInclusive sh:maxInclusive sh:pattern ) ] ; sh:minCount 1 ] ]  
          [ sh:path sh:datatype ; sh:minCount 1 ] ) ] ;
      sh:message "A property constraint may only specify one or more of the following: sh:minExclusive, sh:maxExclusive, sh:minInclusive, sh:maxInclusive, sh:pattern, only if also sh:datatype is specified." ]
.
shp:AttributeShape a sh:NodeShape ;
  sh:deactivated true ;
  sh:targetClass imf-m:AttributeType ;
  sh:property 
    [ sh:path ( sh:property sh:path ) ; sh:hasValue imf-m:predicate ; sh:minCount 1 ; sh:maxCount 1 ;
      sh:severity sh:Warning ; sh:message "The AttributeType does not specify a imf-m:predicate." ] 
.
