DOCUMENT START TOKENS SKIP : { " " | "\t" | "\n" | "\r" | "\f" } SPECIAL : { } TOKEN : { <#WS: " " | "\t" | "\n" | "\r" | "\f"> | | <#ECHAR: "\\" ("t" | "b" | "n" | "r" | "f" | "\\" | "\"" | "\'")> | )* "\""> | | ()+ ("-" ()+)*> | | | ","<","\"","{","}","^","\\","|","`","\u0000"-" "])* ">"> | )? ":"> | > | > | > | > | <#PN_CHARS_BASE: ["A"-"Z"] | ["a"-"z"] | ["\u00c0"-"\u00d6"] | ["\u00d8"-"\u00f6"] | ["\u00f8"-"\u02ff"] | ["\u0370"-"\u037d"] | ["\u037f"-"\u1fff"] | ["\u200c"-"\u200d"] | ["\u2070"-"\u218f"] | ["\u2c00"-"\u2fef"] | ["\u3001"-"\ud7ff"] | ["\uf900"-"\ufffd"]> | <#PN_CHARS_U: | "_"> | <#PN_CHARS: | "-" | ["0"-"9"] | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"]> | <#PN_PREFIX: (( | ".")* )?> | <#PN_LOCAL: ( | ["0"-"9"]) (( | ".")* )?> | <#VARNAME: ( | ["0"-"9"]) ( | ["0"-"9"] | "\u00b7" | ["\u0300"-"\u036f"] | ["\u203f"-"\u2040"])*> } // End of tokens. // Catch-all tokens. Must be last. // Any non-whitespace. Causes a parser exception, rather than a // token manager error (with hidden line numbers). // Only bad IRIs (e.g. spaces) now give unhelpful parse errors. TOKEN : { <#UNKNOWN: (~[" ","\t","\n","\r","\f"])+> } NON-TERMINALS nonNegativeInteger := quotedString := languageTag := nodeID := fullIRI := prefixName := abbreviatedIRI := IRI := ( fullIRI | abbreviatedIRI ) ontologyDocument := ( prefixDeclaration )* Ontology prefixDeclaration := "Prefix" "(" prefixName "=" fullIRI ")" 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 := "SubAnnotationPropertyOf" "(" axiomAnnotations subAnnotationProperty superAnnotationProperty ")" subAnnotationProperty := AnnotationProperty superAnnotationProperty := AnnotationProperty AnnotationPropertyDomain := "AnnotationPropertyDomain" "(" axiomAnnotations AnnotationProperty IRI ")" AnnotationPropertyRange := "AnnotationPropertyRange" "(" axiomAnnotations AnnotationProperty IRI ")" Class := IRI Datatype := IRI ObjectProperty := IRI DataProperty := IRI AnnotationProperty := IRI Individual := ( NamedIndividual | AnonymousIndividual ) NamedIndividual := IRI AnonymousIndividual := nodeID Literal := lexicalForm ( "^^" Datatype | languageTag )? // void typedLiteral(): { } // { // lexicalForm() "^^" Datatype() // } lexicalForm := quotedString // void stringLiteralNoLanguage(): { } // { // quotedString() // } // // void stringLiteralWithLanguage(): { } // { // quotedString() languageTag() // } ObjectPropertyExpression := ( ObjectProperty | InverseObjectProperty ) InverseObjectProperty := "ObjectInverseOf" "(" ObjectProperty ")" DataPropertyExpression := DataProperty DataRange := ( Datatype | DataIntersectionOf | DataUnionOf | DataComplementOf | DataOneOf | DatatypeRestriction ) DataIntersectionOf := "DataIntersectionOf" "(" DataRange DataRange ( DataRange )* ")" DataUnionOf := "DataUnionOf" "(" DataRange DataRange ( DataRange )* ")" DataComplementOf := "DataComplementOf" "(" DataRange ")" DataOneOf := "DataOneOf" "(" 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 := "ObjectIntersectionOf" "(" ClassExpression ClassExpression ( ClassExpression )* ")" ObjectUnionOf := "ObjectUnionOf" "(" ClassExpression ClassExpression ( ClassExpression )* ")" ObjectComplementOf := "ObjectComplementOf" "(" ClassExpression ")" ObjectOneOf := "ObjectOneOf" "(" Individual ( Individual )* ")" ObjectSomeValuesFrom := "ObjectSomeValuesFrom" "(" ObjectPropertyExpression ClassExpression ")" ObjectAllValuesFrom := "ObjectAllValuesFrom" "(" ObjectPropertyExpression ClassExpression ")" ObjectHasValue := "ObjectHasValue" "(" ObjectPropertyExpression Individual ")" ObjectHasSelf := "ObjectHasSelf" "(" ObjectPropertyExpression ")" ObjectMinCardinality := "ObjectMinCardinality" "(" nonNegativeInteger ObjectPropertyExpression ( ClassExpression )? ")" ObjectMaxCardinality := "ObjectMaxCardinality" "(" nonNegativeInteger ObjectPropertyExpression ( ClassExpression )? ")" ObjectExactCardinality := "ObjectExactCardinality" "(" nonNegativeInteger ObjectPropertyExpression ( ClassExpression )? ")" DataSomeValuesFrom := "DataSomeValuesFrom" "(" DataPropertyExpression ( DataPropertyExpression )* DataRange ")" DataAllValuesFrom := "DataAllValuesFrom" "(" DataPropertyExpression ( DataPropertyExpression )* DataRange ")" DataHasValue := "DataHasValue" "(" DataPropertyExpression Literal ")" DataMinCardinality := "DataMinCardinality" "(" nonNegativeInteger DataPropertyExpression ( DataRange )? ")" DataMaxCardinality := "DataMaxCardinality" "(" nonNegativeInteger DataPropertyExpression ( DataRange )? ")" DataExactCardinality := "DataExactCardinality" "(" nonNegativeInteger DataPropertyExpression ( DataRange )? ")" Axiom := ( Declaration | ClassAxiom | ObjectPropertyAxiom | DataPropertyAxiom | DatatypeDefinition | HasKey | Assertion | AnnotationAxiom ) ClassAxiom := ( SubClassOf | EquivalentClasses | DisjointClasses | DisjointUnion ) SubClassOf := "SubClassOf" "(" axiomAnnotations subClassExpression superClassExpression ")" subClassExpression := ClassExpression superClassExpression := ClassExpression EquivalentClasses := "EquivalentClasses" "(" axiomAnnotations ClassExpression ClassExpression ( ClassExpression )* ")" DisjointClasses := "DisjointClasses" "(" axiomAnnotations ClassExpression ClassExpression ( ClassExpression )* ")" DisjointUnion := "DisjointUnion" "(" axiomAnnotations Class disjointClassExpressions ")" disjointClassExpressions := ClassExpression ClassExpression ( ClassExpression )* ObjectPropertyAxiom := ( SubObjectPropertyOf | EquivalentObjectProperties | DisjointObjectProperties | InverseObjectProperties | ObjectPropertyDomain | ObjectPropertyRange | FunctionalObjectProperty | InverseFunctionalObjectProperty | ReflexiveObjectProperty | IrreflexiveObjectProperty | SymmetricObjectProperty | AsymmetricObjectProperty | TransitiveObjectProperty ) SubObjectPropertyOf := "SubObjectPropertyOf" "(" axiomAnnotations subObjectPropertyExpression superObjectPropertyExpression ")" subObjectPropertyExpression := ( ObjectPropertyExpression | propertyExpressionChain ) propertyExpressionChain := "ObjectPropertyChain" "(" ObjectPropertyExpression ObjectPropertyExpression ( ObjectPropertyExpression )* ")" superObjectPropertyExpression := ObjectPropertyExpression EquivalentObjectProperties := "EquivalentObjectProperties" "(" axiomAnnotations ObjectPropertyExpression ObjectPropertyExpression ( ObjectPropertyExpression )* ")" DisjointObjectProperties := "DisjointObjectProperties" "(" axiomAnnotations ObjectPropertyExpression ObjectPropertyExpression ( ObjectPropertyExpression )* ")" ObjectPropertyDomain := "ObjectPropertyDomain" "(" axiomAnnotations ObjectPropertyExpression ClassExpression ")" ObjectPropertyRange := "ObjectPropertyRange" "(" axiomAnnotations ObjectPropertyExpression ClassExpression ")" InverseObjectProperties := "InverseObjectProperties" "(" axiomAnnotations ObjectPropertyExpression ObjectPropertyExpression ")" FunctionalObjectProperty := "FunctionalObjectProperty" "(" axiomAnnotations ObjectPropertyExpression ")" InverseFunctionalObjectProperty := "InverseFunctionalObjectProperty" "(" axiomAnnotations ObjectPropertyExpression ")" ReflexiveObjectProperty := "ReflexiveObjectProperty" "(" axiomAnnotations ObjectPropertyExpression ")" IrreflexiveObjectProperty := "IrreflexiveObjectProperty" "(" axiomAnnotations ObjectPropertyExpression ")" SymmetricObjectProperty := "SymmetricObjectProperty" "(" axiomAnnotations ObjectPropertyExpression ")" AsymmetricObjectProperty := "AsymmetricObjectProperty" "(" axiomAnnotations ObjectPropertyExpression ")" TransitiveObjectProperty := "TransitiveObjectProperty" "(" axiomAnnotations ObjectPropertyExpression ")" DataPropertyAxiom := ( SubDataPropertyOf | EquivalentDataProperties | DisjointDataProperties | DataPropertyDomain | DataPropertyRange | FunctionalDataProperty ) SubDataPropertyOf := "SubDataPropertyOf" "(" axiomAnnotations subDataPropertyExpression superDataPropertyExpression ")" subDataPropertyExpression := DataPropertyExpression superDataPropertyExpression := DataPropertyExpression EquivalentDataProperties := "EquivalentDataProperties" "(" axiomAnnotations DataPropertyExpression DataPropertyExpression ( DataPropertyExpression )* ")" DisjointDataProperties := "DisjointDataProperties" "(" axiomAnnotations DataPropertyExpression DataPropertyExpression ( DataPropertyExpression )* ")" DataPropertyDomain := "DataPropertyDomain" "(" axiomAnnotations DataPropertyExpression ClassExpression ")" DataPropertyRange := "DataPropertyRange" "(" axiomAnnotations DataPropertyExpression DataRange ")" FunctionalDataProperty := "FunctionalDataProperty" "(" axiomAnnotations DataPropertyExpression ")" DatatypeDefinition := "DatatypeDefinition" "(" axiomAnnotations Datatype DataRange ")" HasKey := "HasKey" "(" axiomAnnotations ClassExpression "(" ( 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 := "ObjectPropertyAssertion" "(" axiomAnnotations ObjectPropertyExpression sourceIndividual targetIndividual ")" NegativeObjectPropertyAssertion := "NegativeObjectPropertyAssertion" "(" axiomAnnotations ObjectPropertyExpression sourceIndividual targetIndividual ")" DataPropertyAssertion := "DataPropertyAssertion" "(" axiomAnnotations DataPropertyExpression sourceIndividual targetValue ")" NegativeDataPropertyAssertion := "NegativeDataPropertyAssertion" "(" axiomAnnotations DataPropertyExpression sourceIndividual targetValue ")" DOCUMENT END