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 xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX bnf: <http://www.w3.org/2000/10/swap/grammar/bnf#>
PREFIX linkml: <https://w3id.org/linkml/>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX vann: <http://purl.org/vocab/vann/>

<http://www.w3.org/2000/10/swap/grammar/bnf> a owl:Ontology ;
  vann:preferredNamespacePrefix "bnf" ;
  vann:preferredNamespaceUri "http://www.w3.org/2000/10/swap/grammar/bnf#"^^xsd:anyURI ;
  sh:declare [
    sh:prefix "bnf" ;
    sh:namespace "http://www.w3.org/2000/10/swap/grammar/bnf#"^^xsd:anyURI
  ] , [
    sh:prefix "linkml" ;
    sh:namespace "https://w3id.org/linkml/"^^xsd:anyURI
  ] .

bnf:String a owl:Class .

bnf:Production a owl:Class ;
  rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty bnf:canStartWith ;
    owl:allValuesFrom bnf:String
  ] , [
    a owl:Restriction ;
    owl:onProperty bnf:mustBeOneSequence ;
    owl:allValuesFrom bnf:ListOfSequencesOfProductions
  ] , [
    a owl:Restriction ;
    owl:onProperty bnf:commaSeparatedPeriodTerminatedListOf ;
    owl:allValuesFrom bnf:Production
  ] , [
    a owl:Restriction ;
    owl:onProperty bnf:mustBe ;
    owl:allValuesFrom bnf:Production
  ] .

bnf:ListOfSequencesOfProductions a owl:Class .

bnf:Token a owl:Class ;
  rdfs:label "token" ;
  rdfs:comment """A terminal, aka atomic, production,
\tdefined as string or regexp""" ;
  rdfs:subClassOf bnf:Production , [
    a owl:Restriction ;
    owl:onProperty bnf:matches ;
    owl:allValuesFrom bnf:RegularExpression
  ] .

bnf:RegularExpression a owl:Class .

bnf:Term a owl:Class ;
  rdfs:subClassOf [
    a owl:Restriction ;
    owl:onProperty bnf:zeroOrMore ;
    owl:allValuesFrom bnf:Production
  ] .

bnf:canStartWith a owl:ObjectProperty ;
  rdfs:label "can start with" ;
  rdfs:comment """The production can only start with the given
\t\trepresentative character. In the case that a token starts
\t\twith always the same character, that is the one given.
\t\tIn th eevent that it can start with alpha character, 'a'
\t\tis given; if it can start with a numeric, '0' is given
\t\tas the value for this predicate.  This predicate is used
\t\tonly when a predictive parser is possible and desired.""" ;
  rdfs:range bnf:String ;
  rdfs:domain bnf:Production .

bnf:mustBeOneSequence a owl:ObjectProperty ;
  rdfs:label "productions" ;
  rdfs:comment """This is the core property you need to define a BNF production.
It defines the list of the only sequences to which a given 
term may expand.  Each sequence is just a list of other productions in order.
""" ;
  rdfs:range bnf:ListOfSequencesOfProductions ;
  rdfs:domain bnf:Production .

bnf:matches a owl:ObjectProperty ;
  rdfs:label "matches" ;
  rdfs:comment """The given token is defined by the
\t\tregular expression which a token must match""" ;
  rdfs:range bnf:RegularExpression ;
  rdfs:domain bnf:Token .

bnf:zeroOrMore a owl:ObjectProperty ;
  rdfs:label "zero or more" ;
  rdfs:range bnf:Production ;
  rdfs:domain bnf:Term .

bnf:commaSeparatedPeriodTerminatedListOf a owl:ObjectProperty ;
  rdfs:label "comma-separated period-terminated list of" ;
  rdfs:range bnf:Production ;
  rdfs:domain bnf:Production .

bnf:mustBe a owl:ObjectProperty ;
  rdfs:range bnf:Production ;
  rdfs:domain bnf:Production .

vann:preferredNamespacePrefix a owl:AnnotationProperty .

vann:preferredNamespaceUri a owl:AnnotationProperty .

sh:declare a owl:AnnotationProperty .

sh:prefix a owl:AnnotationProperty .

sh:namespace a owl:AnnotationProperty .
