PREFIX st:   <http://ns.inria.fr/sparql-template/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX fun: <http://w3id.org/sparql-generate/fn/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX swrl: <http://www.w3.org/2003/11/swrl#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
 
BASE <https://saref.etsi.org/documentation/>

# See https://www.w3.org/TR/owl2-quick-reference/#Facets

TEMPLATE  <facetDescription.rqg>( ?restriction ) {

  # xsd:minInclusive
  TEMPLATE {
    "<span class='logic'>minInclusive</span> "
    TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) .
  } WHERE {
    ?restriction xsd:minInclusive ?v .
  } .

  # xsd:maxInclusive
  TEMPLATE {
    "<span class='logic'>maxInclusive</span> "
    TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) .
  } WHERE {
    ?restriction xsd:maxInclusive ?v .
  } .

  # xsd:minExclusive
  TEMPLATE {
    "<span class='logic'>minExclusive</span> "
    TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) .
  } WHERE {
    ?restriction xsd:minExclusive ?v .
  } .

  # xsd:maxExclusive
  TEMPLATE {
    "<span class='logic'>maxExclusive</span> "
    "TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) ."
  } WHERE {
    ?restriction xsd:maxExclusive ?v .
  } .

  # xsd:minLength
  TEMPLATE {
    "<span class='logic'>minLength</span> "
    TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) .
  } WHERE {
    ?restriction xsd:minLength ?v .
  } .

  # xsd:maxLength
  TEMPLATE {
    "<span class='logic'>maxLength</span> "
    TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) .
  } WHERE {
    ?restriction xsd:maxLength ?v .
  } .

  # xsd:length
  TEMPLATE {
    "<span class='logic'>length</span> "
    TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) .
  } WHERE {
    ?restriction xsd:length ?v .
  } .

  # xsd:pattern
  TEMPLATE {
    "<span class='logic'>pattern</span> "
    TEMPLATE <individualAndLiteralDescription.rqg>( <en.properties>, ?v) .
  } WHERE {
    ?restriction xsd:pattern ?v .
  } .


  # xsd:pattern
  TEMPLATE {
    "<strong>Warning: unknown facet</strong>"
  } WHERE {
    ?restriction ?p ?v .
    FILTER( ?p !=  xsd:minInclusive
      && ?p !=  xsd:maxInclusive
      && ?p !=  xsd:minExclusive
      && ?p !=  xsd:maxExclusive
      && ?p !=  xsd:minLength
      && ?p !=  xsd:maxLength
      && ?p !=  xsd:length
      && ?p !=  xsd:pattern )
  } .

  ; separator = ", "

}