@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/ontology-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/ontology-grammar> a owl:Ontology ;
    owl:versionIRI <https://ns.imfid.org/imf-m/shapes/0.2.0/ontology-grammar> ;
    owl:versionInfo "0.2.0" ;
    skos:prefLabel "IMF Ontology Grammar -- SHACL" ;
    dc:description """
These SHACL Shapes specify requirements on the definition of terms in the IMF ontology and is therefore useful only for the development of the IMF ontology.""" ;
    pav:createdBy [ foaf:name "Martin G. Skjæveland" ] ;
    pav:createdOn "2023-06-30T00:00:00"^^xsd:dateTime ;
    owl:imports 
      <http://shipshape.dyreriket.xyz/std-vocabulary-elements.ttl>, 
      <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#> ,
      <https://ns.imfid.org/imf-m/shapes/0.2.0/terms-grammar> ;
    skos:editorialNote """Result of validation against specified sh:shapesGraph:
Result of validating RDF data <out/shacl/imf-ontology-grammar.shacl.ttl> against SHACL shape <http://www.w3.org/ns/shacl-shacl#>:
2023-06-30
Conforms


Result of validating RDF data <out/shacl/imf-ontology-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-ontology-grammar.shacl.ttl> against SHACL shape <http://ns.imfid.org/20230630/imf-terms-grammar.shacl.ttl>:
2023-06-30
Conforms

    """
.


_:TermMetadata a sh:NodeShape ;
  sh:target [
    a sh:SPARQLTarget ;
    sh:select """
      PREFIX owl:   <http://www.w3.org/2002/07/owl#> 
      PREFIX skos:  <http://www.w3.org/2004/02/skos/core#>
      SELECT ?this { 
        ?this a ?type 
	FILTER (STRSTARTS(STR(?this), 'https://ns.imfid.org/imf-m/id/'))
        FILTER (isIRI(?this))
        #FILTER (?type IN ( owl:Class, owl:NamedIndividual, owl:ObjectProperty, owl:DatatypeProperty, owl:AnnotationProperty ))
        FILTER (?type != owl:Ontology)
        FILTER NOT EXISTS { 
	  ?this skos:note ?note .
	  FILTER (STRSTARTS(STR(?note), 'This resource is programatically generated.'))
	}
        FILTER NOT EXISTS { 
	  ?this skos:exactMatch [] .
        }
      }
      ## ORDER BY ?this
      """ 
  ] ;
  sh:property 
    [ sh:path vs:term_status ; sh:minCount 1 ; sh:maxCount 1 ; sh:in ( "unstable" "testing" "stable" "archaic" ) ] ,
    [ sh:path vann:termGroup ; sh:minCount 1 ; sh:maxCount 1 ; sh:in ( "elements" "aspects" "attributes" "generic relations" "model" ) ] ,
    [ sh:path skos:prefLabel ; sh:minCount 1 ; sh:maxCount 1 ; sh:datatype xsd:string ] ,
    [ sh:path skos:definition ; sh:minCount 1 ; sh:maxCount 1 ; sh:datatype xsd:string  ] ,
    [ sh:path skos:changeNote ; sh:minCount 1 ; sh:pattern "^[0-9].[0-9].[0-9] :: [Added|Changed:]" ]
    #[ sh:path skos:scopeNote ; sh:minCount 1 ; sh:severity sh:Warning ] 
.
