################################################################################# ################################ KM3 Grammar #################################### ################################################################################# package = "package" name "{" classifiers "}"; classifiers = classifier {classifier}; classifier = class | datatype | enumeration | property; class = ["abstract"] "class" name [supertypes] [classAxioms] "{" features "}"; # extended by adding class axioms supertypes = "extends" typelist; typelist = {typeref", "} typeref; features = {feature}; feature = attribute | reference | query; attribute = "attribute" name multiplicity ":" typeref [dataPropertyAxioms] ";"; reference = "reference" name multiplicity iscontainer ":" typeref "oppositeOf" name [objectPropertyAxioms] ";"; multiplicity = bounds ("ordered"); bounds = "[" integer "-" integer "]" | "[" integer "- * ]" | "[ * ]"; iscontainer = ("container"); datatype = "datatype" name ; enumeration = "enumeration" name "{" literals "}"; literals = literal { ";" literal }; literal = "literal" name ; typeref = name; digit = "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"; integer = digit {digit}; name = ( letter | "_" ) { letter | digit | "_" } ; letter = "a".."z" | "A".."Z" ; ################################################################################# ########################### Additional Rules #################################### ################################################################################# classAxioms = ClassAxiom { "," ClassAxiom}; dataPropertyAxioms = DataPropertyAxiom { "," DataPropertyAxiom}; objectPropertyAxioms = ObjectPropertyAxiom { "," ObjectPropertyAxiom}; property = objectProperty | dataProperty; objectProperty = "ObjectProperty" "{" {objectPropertyFeatures} "}"; objectPropertyFeatures = "domain" ClassExpression | "range" ClassExpression | "axiom" ObjectPropertyAxiom; dataProperty = "DataProperty" "{" {dataPropertyFeatures} "}"; dataPropertyFeatures = "domain" ClassExpression | "range" DataRange | "axiom" ObjectPropertyAxiom; query = "query" ################################################################################# ############################ OWL 2 Grammar ###################################### ################################################################################# fullIRI = name; #"IRI as defined in [RFC3987], enclosed in a pair of < (U+3C) and > (U+3E) characters" NCName = name; #"as defined in [XML Namespaces]" irelativeref = name; #"as defined in [RFC3987]" nonNegativeInteger = name; #"a nonempty finite sequence of digits between 0 and 9"; quotedString = name; #"a finite sequence of characters in which " (U+22) and \ (U+5C) occur only in pairs of the form \" (U+22, U+5C) and \\ (U+22, U+22), enclosed in a pair of " (U+22) characters"; languageTag = name; #"a nonempty (not quoted) string defined as specified in BCP 47 [BCP 47]"; nodeID = name; # "a node ID of the form _:name as specified in the N-Triples specification [RDF Test Cases]"; namespace = fullIRI; prefix = NCName; # reference = irelativeref; curie = [ [ prefix ] ":" ] reference; IRI = fullIRI | curie; ontologyDocument = { prefixDefinition } Ontology; prefixDefinition = "Namespace" "(" [ prefix ] "=" namespace ")"; Ontology = "Ontology" "(" [ ontologyIRI [ versionIRI ] ] directlyImportsDocuments ontologyAnnotations axioms ")"; ontologyIRI = IRI; versionIRI = IRI; directlyImportsDocuments = { "Import" "(" IRI ")" }; ontologyAnnotations = { Annotation }; axioms = { Axiom }; Declaration = "Declaration" "(" axiomAnnotations Entity ")"; Entity = "Class" "(" Class ")" | "Datatype" "(" Datatype ")" | "ObjectProperty" "(" ObjectProperty ")" | "DataProperty" "(" DataProperty ")" | "AnnotationProperty" "(" AnnotationProperty ")" | "NamedIndividual" "(" NamedIndividual ")"; AnnotationSubject = IRI | AnonymousIndividual; AnnotationValue = AnonymousIndividual | IRI | Literal; axiomAnnotations = { Annotation }; Annotation = "Annotation" "(" annotationAnnotations AnnotationProperty AnnotationValue ")"; annotationAnnotations = { Annotation }; AnnotationAxiom = AnnotationAssertion | SubAnnotationPropertyOf | AnnotationPropertyDomain | AnnotationPropertyRange; AnnotationAssertion = "AnnotationAssertion" "(" axiomAnnotations AnnotationProperty AnnotationSubject AnnotationValue ")"; SubAnnotationPropertyOf = "SubPropertyOf" "(" axiomAnnotations subAnnotationProperty superAnnotationProperty ")"; subAnnotationProperty = AnnotationProperty; superAnnotationProperty = AnnotationProperty; AnnotationPropertyDomain = "PropertyDomain" "(" axiomAnnotations AnnotationProperty IRI ")"; AnnotationPropertyRange = "PropertyRange" "(" axiomAnnotations AnnotationProperty IRI ")"; Class = IRI; Datatype = IRI; ObjectProperty = IRI; DataProperty = IRI; AnnotationProperty = IRI; Individual = NamedIndividual | AnonymousIndividual; NamedIndividual = IRI; AnonymousIndividual = nodeID; Literal = typedLiteral | abbreviatedXSDStringLiteral | abbreviatedRDFTextLiteral; typedLiteral = lexicalValue "^^" Datatype; lexicalValue = quotedString; abbreviatedXSDStringLiteral = quotedString; abbreviatedRDFTextLiteral = quotedString "@" languageTag; ObjectPropertyExpression = ObjectProperty | InverseObjectProperty; InverseObjectProperty = "InverseOf" "(" ObjectProperty ")"; DataPropertyExpression = DataProperty; DataRange = Datatype | DataIntersectionOf | DataUnionOf | DataComplementOf | DataOneOf | DatatypeRestriction; DataIntersectionOf = "IntersectionOf" "(" DataRange DataRange { DataRange } ")"; DataUnionOf = "UnionOf" "(" DataRange DataRange { DataRange } ")"; DataComplementOf = "ComplementOf" "(" DataRange ")"; DataOneOf = "OneOf" "(" Literal { Literal } ")"; DatatypeRestriction = "DatatypeRestriction" "(" Datatype constrainingFacet restrictionValue { constrainingFacet restrictionValue } ")"; constrainingFacet = IRI; restrictionValue = Literal; ClassExpression = Class | ObjectIntersectionOf | ObjectUnionOf | ObjectComplementOf | ObjectOneOf | ObjectSomeValuesFrom | ObjectAllValuesFrom | ObjectHasValue | ObjectHasSelf | ObjectMinCardinality | ObjectMaxCardinality | ObjectExactCardinality | DataSomeValuesFrom | DataAllValuesFrom | DataHasValue | DataMinCardinality | DataMaxCardinality | DataExactCardinality; ObjectIntersectionOf = "IntersectionOf" "(" ClassExpression ClassExpression { ClassExpression } ")"; ObjectUnionOf = "UnionOf" "(" ClassExpression ClassExpression { ClassExpression } ")"; ObjectComplementOf = "ComplementOf" "(" ClassExpression ")"; ObjectOneOf = "OneOf" "(" Individual { Individual }")"; ObjectSomeValuesFrom = "SomeValuesFrom" "(" ObjectPropertyExpression ClassExpression ")"; ObjectAllValuesFrom = "AllValuesFrom" "(" ObjectPropertyExpression ClassExpression ")"; ObjectHasValue = "HasValue" "(" ObjectPropertyExpression Individual ")"; ObjectHasSelf = "HasSelf" "(" ObjectPropertyExpression ")"; ObjectMinCardinality = "MinCardinality" "(" nonNegativeInteger ObjectPropertyExpression [ ClassExpression ] ")"; ObjectMaxCardinality = "MaxCardinality" "(" nonNegativeInteger ObjectPropertyExpression [ ClassExpression ] ")"; ObjectExactCardinality = "ExactCardinality" "(" nonNegativeInteger ObjectPropertyExpression [ ClassExpression ] ")"; DataSomeValuesFrom = "SomeValuesFrom" "(" DataPropertyExpression { DataPropertyExpression } DataRange ")"; DataAllValuesFrom = "AllValuesFrom" "(" DataPropertyExpression { DataPropertyExpression } DataRange ")"; DataHasValue = "HasValue" "(" DataPropertyExpression Literal ")"; DataMinCardinality = "MinCardinality" "(" nonNegativeInteger DataPropertyExpression [ DataRange ] ")"; DataMaxCardinality = "MaxCardinality" "(" nonNegativeInteger DataPropertyExpression [ DataRange ] ")"; DataExactCardinality = "ExactCardinality" "(" nonNegativeInteger DataPropertyExpression [ DataRange ] ")"; Axiom = Declaration | ClassAxiom | ObjectPropertyAxiom | DataPropertyAxiom | HasKey | Assertion | AnnotationAxiom; ClassAxiom = SubClassOf | EquivalentClasses | DisjointClasses | DisjointUnion; SubClassOf = "SubClassOf" "(" superClassExpression ")"; superClassExpression = ClassExpression; EquivalentClasses = "EquivalentClasses" "(" ClassExpression { "," ClassExpression } ")"; DisjointClasses = "DisjointClasses" "(" ClassExpression { "," ClassExpression } ")"; DisjointUnion = "DisjointUnion" "(" disjointClassExpressions ")"; disjointClassExpressions = ClassExpression ClassExpression { ClassExpression }; ObjectPropertyAxiom = SubObjectPropertyOf | EquivalentObjectProperties | DisjointObjectProperties | InverseObjectProperties | FunctionalObjectProperty | InverseFunctionalObjectProperty | ReflexiveObjectProperty | IrreflexiveObjectProperty | SymmetricObjectProperty | AsymmetricObjectProperty | TransitiveObjectProperty; SubObjectPropertyOf = "SubPropertyOf" superObjectPropertyExpression; superObjectPropertyExpression = ObjectPropertyExpression; EquivalentObjectProperties = "EquivalentProperties" ObjectPropertyExpression { "," ObjectPropertyExpression }; DisjointObjectProperties = "DisjointProperties" ObjectPropertyExpression { "," ObjectPropertyExpression }; InverseObjectProperties = "InverseProperties" ObjectPropertyExpression ObjectPropertyExpression; FunctionalObjectProperty = "FunctionalProperty" ObjectPropertyExpression; InverseFunctionalObjectProperty = "InverseFunctionalProperty" ObjectPropertyExpression; ReflexiveObjectProperty = "ReflexiveProperty" ObjectPropertyExpression; IrreflexiveObjectProperty = "IrreflexiveProperty" ObjectPropertyExpression; SymmetricObjectProperty = "SymmetricProperty" ObjectPropertyExpression; AsymmetricObjectProperty = "AsymmetricProperty" ObjectPropertyExpression; TransitiveObjectProperty = "TransitiveProperty" ObjectPropertyExpression; DataPropertyAxiom = SubDataPropertyOf | EquivalentDataProperties | DisjointDataProperties | FunctionalDataProperty; SubDataPropertyOf = "SubPropertyOf" superDataPropertyExpression; superDataPropertyExpression = DataPropertyExpression; EquivalentDataProperties = "EquivalentProperties" DataPropertyExpression { "," DataPropertyExpression }; DisjointDataProperties = "DisjointProperties" DataPropertyExpression { DataPropertyExpression }; FunctionalDataProperty = "FunctionalProperty"; HasKey = "HasKey" "(" axiomAnnotations ClassExpression ObjectPropertyExpression | DataPropertyExpression { ObjectPropertyExpression | DataPropertyExpression } ")"; Assertion = SameIndividual | DifferentIndividuals | ClassAssertion | ObjectPropertyAssertion | NegativeObjectPropertyAssertion | DataPropertyAssertion | NegativeDataPropertyAssertion; sourceIndividual = Individual; targetIndividual = Individual; targetValue = Literal; SameIndividual = "SameIndividual" "(" axiomAnnotations Individual Individual { Individual } ")"; DifferentIndividuals = "DifferentIndividuals" "(" axiomAnnotations Individual Individual { Individual } ")"; ClassAssertion = "ClassAssertion" "(" axiomAnnotations ClassExpression Individual ")"; ObjectPropertyAssertion = "PropertyAssertion" "(" axiomAnnotations ObjectPropertyExpression sourceIndividual targetIndividual ")"; NegativeObjectPropertyAssertion = "NegativePropertyAssertion" "(" axiomAnnotations ObjectPropertyExpression sourceIndividual targetIndividual ")"; DataPropertyAssertion = "PropertyAssertion" "(" axiomAnnotations DataPropertyExpression sourceIndividual targetValue ")"; NegativeDataPropertyAssertion = "NegativePropertyAssertion" "(" axiomAnnotations DataPropertyExpression sourceIndividual targetValue ")";