The Structural Specification and Functional-Style Syntax of OWL 2 document contains BNF rules for the syntax constructs. But they are scattered over multiple documents (including SPARQL specification and RFC 3987). Is there a ready to use OWL Functional-Style Syntax grammar suitable for ANTLR or yacc or a similar tool?

asked 11 Dec '12, 02:55

utapyngo's gravatar image

utapyngo
1.9k312
accept rate: 19%

edited 11 Dec '12, 02:56

You may send a mail to Boris Motik at Oxford University, asking him whether such a document exists, because he was the main author of the OWL 2 Structural Specification document.

(11 Dec '12, 19:01) Michael Schn... ♦ Michael%20Schneider's gravatar image

Answering my owl own question.

I have taken the OWLFunctionalSyntaxParser.jj file from OWL API and converted it using this online tool mentioned in this answer on StackOverflow.

Here is the result (sorry for large output, there is no spoiler in markdown, I am putting the result here so everyone can see the answer even if the online tool goes offline):


parse    ::= Prefix* Ontology EOF
Ontology ::= 'Ontology' '(' ( IRI IRI? )? ( ImportsDeclaration | Annotation )* Axiom* ')'
Prefix   ::= 'Prefix' '(' PrefixName '=' FullIRI ')'
IRI      ::= FullIRI
           | AbbreviatedIRI
FullIRI  ::= FULLIRI
AbbreviatedIRI
         ::= PNAME_LN
PrefixName
         ::= PNAME_NS
ClassExpression
         ::= ClassIRI
           | ObjectUnionOf
           | ObjectIntersectionOf
           | ObjectComplementOf
           | ObjectOneOf
           | ObjectSomeValuesFrom
           | ObjectAllValuesFrom
           | ObjectHasValue
           | ObjectSelf
           | ObjectMinCardinality
           | ObjectExactCardinality
           | ObjectMaxCardinality
           | DataSomeValuesFrom
           | DataAllValuesFrom
           | DataHasValue
           | DataMinCardinality
           | DataExactCardinality
           | DataMaxCardinality
ClassIRI ::= IRI
ClassExpressionSet
         ::= ClassExpression ClassExpression ClassExpression*
IndividualMinOneSet
         ::= Individual Individual*
ObjectUnionOf
         ::= 'ObjectUnionOf' '(' ClassExpressionSet ')'
ObjectIntersectionOf
         ::= 'ObjectIntersectionOf' '(' ClassExpressionSet ')'
ObjectComplementOf
         ::= 'ObjectComplementOf' '(' ClassExpression ')'
ObjectOneOf
         ::= 'ObjectOneOf' '(' IndividualMinOneSet ')'
ObjectAllValuesFrom
         ::= 'ObjectAllValuesFrom' '(' ObjectPropertyExpression ClassExpression ')'
ObjectSomeValuesFrom
         ::= 'ObjectSomeValuesFrom' '(' ObjectPropertyExpression ClassExpression ')'
ObjectHasValue
         ::= 'ObjectHasValue' '(' ObjectPropertyExpression Individual ')'
ObjectSelf
         ::= 'ObjectHasSelf' '(' ObjectPropertyExpression ')'
ObjectMinCardinality
         ::= 'ObjectMinCardinality' '(' Cardinality ObjectPropertyExpression ClassExpression? ')'
ObjectExactCardinality
         ::= 'ObjectExactCardinality' '(' Cardinality ObjectPropertyExpression ClassExpression? ')'
ObjectMaxCardinality
         ::= 'ObjectMaxCardinality' '(' Cardinality ObjectPropertyExpression ClassExpression? ')'
DataAllValuesFrom
         ::= 'DataAllValuesFrom' '(' DataPropertyExpression DataRange ')'
DataSomeValuesFrom
         ::= 'DataSomeValuesFrom' '(' DataPropertyExpression DataRange ')'
DataHasValue
         ::= 'DataHasValue' '(' DataPropertyExpression Literal ')'
DataMinCardinality
         ::= 'DataMinCardinality' '(' Cardinality DataPropertyExpression DataRange? ')'
DataExactCardinality
         ::= 'DataExactCardinality' '(' Cardinality DataPropertyExpression DataRange? ')'
DataMaxCardinality
         ::= 'DataMaxCardinality' '(' Cardinality DataPropertyExpression DataRange? ')'
Class    ::= 'Class' '(' ClassIRI ')'
ObjectPropertyExpression
         ::= InverseObjectProperty
           | ObjectPropertyIRI
InverseObjectProperty
         ::= 'ObjectInverseOf' '(' ObjectPropertyExpression ')'
ObjectProperty
         ::= 'ObjectProperty' '(' ObjectPropertyIRI ')'
DataPropertyExpression
         ::= DataPropertyIRI
DataPropertyIRI
         ::= IRI
DataProperty
         ::= 'DataProperty' '(' DataPropertyIRI ')'
AnnotationProperty
         ::= 'AnnotationProperty' '(' AnnotationPropertyIRI ')'
AnnotationPropertyIRI
         ::= IRI
NamedIndividual
         ::= 'NamedIndividual' '(' IndividualIRI ')'
AnonymousIndividual
         ::= NODEID
Datatype ::= 'Datatype' '(' DatatypeIRI ')'
DatatypeIRI
         ::= IRI
Cardinality
         ::= Integer
Integer  ::= INT
DatatypeDefinitionAxiom
         ::= 'DatatypeDefinition' '(' AxiomAnnotationSet DatatypeIRI DataRange ')'
DataRange
         ::= DatatypeIRI
           | DataOneOf
           | DataComplementOf
           | DataRangeRestriction
           | DataIntersectionOf
           | DataUnionOf
DataComplementOf
         ::= 'DataComplementOf' '(' DataRange ')'
DataOneOf
         ::= 'DataOneOf' '(' Literal+ ')'
DataUnionOf
         ::= 'DataUnionOf' '(' DataRange+ ')'
DataIntersectionOf
         ::= 'DataIntersectionOf' '(' DataRange+ ')'
DataRangeRestriction
         ::= 'DatatypeRestriction' '(' DatatypeIRI DataRangeFacetRestriction+ ')'
DataRangeFacetRestriction
         ::= IRI Literal
Axiom    ::= ClassAxiom
           | ObjectPropertyAxiom
           | DataPropertyAxiom
           | IndividualAxiom
           | Declaration
           | HasKey
           | DatatypeDefinitionAxiom
           | AnnotationAxiom
           | DLSafeRule
ClassAxiom
         ::= SubClassOf
           | EquivalentClasses
           | DisjointClasses
           | DisjointUnion
SubClassOf
         ::= 'SubClassOf' '(' AxiomAnnotationSet ClassExpression ClassExpression ')'
EquivalentClasses
         ::= 'EquivalentClasses' '(' AxiomAnnotationSet ClassExpressionSet ')'
DisjointClasses
         ::= 'DisjointClasses' '(' AxiomAnnotationSet ClassExpressionSet ')'
DisjointUnion
         ::= 'DisjointUnion' '(' AxiomAnnotationSet ClassIRI ClassExpressionSet ')'
ObjectPropertyAxiom
         ::= SubObjectPropertyOf
           | EquivalentObjectProperties
           | DisjointObjectProperties
           | ObjectPropertyRange
           | ObjectPropertyDomain
           | FunctionalObjectProperty
           | InverseFunctionalObjectProperty
           | SymmetricObjectProperty
           | AsymmetricObjectProperty
           | ReflexiveObjectProperty
           | IrreflexiveObjectProperty
           | TransitiveObjectProperty
           | InverseObjectProperties
SubObjectPropertyChain
         ::= 'ObjectPropertyChain' '(' ObjectPropertyExpression ObjectPropertyExpression* ')'
SubObjectPropertyOf
         ::= 'SubObjectPropertyOf' '(' AxiomAnnotationSet ( ObjectPropertyExpression | SubObjectPropertyChain ) ObjectPropertyExpression ')'
EquivalentObjectProperties
         ::= 'EquivalentObjectProperties' '(' AxiomAnnotationSet ObjectPropertySet ')'
DisjointObjectProperties
         ::= 'DisjointObjectProperties' '(' AxiomAnnotationSet ObjectPropertySet ')'
ObjectPropertySet
         ::= ObjectPropertyExpression ObjectPropertyExpression ObjectPropertyExpression*
ObjectPropertyRange
         ::= 'ObjectPropertyRange' '(' AxiomAnnotationSet ObjectPropertyExpression ClassExpression ')'
ObjectPropertyDomain
         ::= 'ObjectPropertyDomain' '(' AxiomAnnotationSet ObjectPropertyExpression ClassExpression ')'
FunctionalObjectProperty
         ::= 'FunctionalObjectProperty' '(' AxiomAnnotationSet ObjectPropertyExpression ')'
InverseObjectProperties
         ::= 'InverseObjectProperties' '(' AxiomAnnotationSet ObjectPropertyExpression ObjectPropertyExpression ')'
InverseFunctionalObjectProperty
         ::= 'InverseFunctionalObjectProperty' '(' AxiomAnnotationSet ObjectPropertyExpression ')'
SymmetricObjectProperty
         ::= 'SymmetricObjectProperty' '(' AxiomAnnotationSet ObjectPropertyExpression ')'
AsymmetricObjectProperty
         ::= 'AsymmetricObjectProperty' '(' AxiomAnnotationSet ObjectPropertyExpression ')'
ReflexiveObjectProperty
         ::= 'ReflexiveObjectProperty' '(' AxiomAnnotationSet ObjectPropertyExpression ')'
IrreflexiveObjectProperty
         ::= 'IrreflexiveObjectProperty' '(' AxiomAnnotationSet ObjectPropertyExpression ')'
TransitiveObjectProperty
         ::= 'TransitiveObjectProperty' '(' AxiomAnnotationSet ObjectPropertyExpression ')'
DataPropertyAxiom
         ::= SubDataPropertyOf
           | EquivalentDataProperties
           | DisjointDataProperties
           | DataPropertyRange
           | DataPropertyDomain
           | FunctionalDataProperty
SubDataPropertyOf
         ::= 'SubDataPropertyOf' '(' AxiomAnnotationSet DataPropertyExpression DataPropertyExpression ')'
EquivalentDataProperties
         ::= 'EquivalentDataProperties' '(' AxiomAnnotationSet DataPropertySet ')'
DisjointDataProperties
         ::= 'DisjointDataProperties' '(' AxiomAnnotationSet DataPropertySet ')'
DataPropertySet
         ::= DataPropertyExpression DataPropertyExpression DataPropertyExpression*
DataPropertyDomain
         ::= 'DataPropertyDomain' '(' AxiomAnnotationSet DataPropertyExpression ClassExpression ')'
DataPropertyRange
         ::= 'DataPropertyRange' '(' AxiomAnnotationSet DataPropertyExpression DataRange ')'
FunctionalDataProperty
         ::= 'FunctionalDataProperty' '(' AxiomAnnotationSet DataPropertyExpression ')'
IndividualAxiom
         ::= SameIndividuals
           | DifferentIndividuals
           | ClassAssertion
           | ObjectPropertyAssertion
           | DataPropertyAssertion
           | NegativeObjectPropertyAssertion
           | NegativeDataPropertyAssertion
IndividualSet
         ::= Individual Individual Individual*
SameIndividuals
         ::= 'SameIndividual' '(' AxiomAnnotationSet IndividualSet ')'
DifferentIndividuals
         ::= 'DifferentIndividuals' '(' AxiomAnnotationSet IndividualSet ')'
ClassAssertion
         ::= 'ClassAssertion' '(' AxiomAnnotationSet ClassExpression Individual ')'
ObjectPropertyAssertion
         ::= 'ObjectPropertyAssertion' '(' AxiomAnnotationSet ObjectPropertyExpression Individual Individual ')'
NegativeObjectPropertyAssertion
         ::= 'NegativeObjectPropertyAssertion' '(' AxiomAnnotationSet ObjectPropertyExpression Individual Individual ')'
DataPropertyAssertion
         ::= 'DataPropertyAssertion' '(' AxiomAnnotationSet DataPropertyExpression Individual Literal ')'
NegativeDataPropertyAssertion
         ::= 'NegativeDataPropertyAssertion' '(' AxiomAnnotationSet DataPropertyExpression Individual Literal ')'
IndividualIRI
         ::= IRI
Individual
         ::= IndividualIRI
           | AnonymousIndividual
ObjectPropertyIRI
         ::= IRI
AnnotationAxiom
         ::= AnnotationAssertion
           | AnnotationPropertyDomain
           | AnnotationPropertyRange
           | SubAnnotationPropertyOf
Annotation
         ::= 'Annotation' '(' Annotation* AnnotationPropertyIRI AnnotationValue ')'
AnnotationSubject
         ::= IRI
           | AnonymousIndividual
AnnotationValue
         ::= IRI
           | AnonymousIndividual
           | Literal
AxiomAnnotationSet
         ::= Annotation*
ImportsDeclaration
         ::= 'Import' '(' IRI ')'
AnnotationAssertion
         ::= 'AnnotationAssertion' '(' AxiomAnnotationSet AnnotationPropertyIRI AnnotationSubject AnnotationValue ')'
SubAnnotationPropertyOf
         ::= 'SubAnnotationPropertyOf' '(' AxiomAnnotationSet AnnotationPropertyIRI AnnotationPropertyIRI ')'
AnnotationPropertyDomain
         ::= 'AnnotationPropertyDomain' '(' AxiomAnnotationSet AnnotationPropertyIRI IRI ')'
AnnotationPropertyRange
         ::= 'AnnotationPropertyRange' '(' AxiomAnnotationSet AnnotationPropertyIRI IRI ')'
HasKey   ::= 'HasKey' '(' AxiomAnnotationSet ClassExpression '(' ObjectPropertyExpression* ')' '(' DataPropertyExpression* ')' ')'
Declaration
         ::= 'Declaration' '(' AxiomAnnotationSet Entity ')'
Entity   ::= Class
           | ObjectProperty
           | DataProperty
           | NamedIndividual
           | Datatype
           | AnnotationProperty
Literal  ::= QuotedString ( '^^' DatatypeIRI | '@' LangTag )?
QuotedString
         ::= '"'
LangTag  ::= PN_LOCAL
DLSafeRule
         ::= 'DLSafeRule' '(' AxiomAnnotationSet 'Body' '(' Atom* ')' 'Head' '(' Atom* ')' ')'
Atom     ::= ClassAtom
           | DataRangeAtom
           | ObjectPropertyAtom
           | DataPropertyAtom
           | BuiltInAtom
           | SameIndividualAtom
           | DifferentIndividualsAtom
ClassAtom
         ::= 'ClassAtom' '(' ClassExpression IArg ')'
DataRangeAtom
         ::= 'DataRangeAtom' '(' DataRange DArg ')'
ObjectPropertyAtom
         ::= 'ObjectPropertyAtom' '(' ObjectPropertyExpression IArg IArg ')'
DataPropertyAtom
         ::= 'DataPropertyAtom' '(' DataPropertyIRI IArg DArg ')'
BuiltInAtom
         ::= 'BuiltInAtom' '(' IRI DArg DArg* ')'
SameIndividualAtom
         ::= 'SameIndividualAtom' '(' IArg IArg ')'
DifferentIndividualsAtom
         ::= 'DifferentIndividualsAtom' '(' IArg IArg ')'
IArg     ::= 'Variable' '(' IRI ')'
           | IndividualIRI
DArg     ::= 'Variable' '(' IRI ')'
           | Literal

<?TOKENS?>

ANY_ESCAPED_CHAR
         ::= '\' .
ANY_CHAR ::= [^"]
INT      ::= [0-9] [0-9]*
FULLIRI  ::= '<' [^> ]* '>'
PNAME_NS ::= PN_PREFIX? ':'
PN_LOCAL ::= ( PN_CHARS_U | [0-9] ) ( ( PN_CHARS | '.' )* PN_CHARS )?
PNAME_LN ::= PNAME_NS PN_LOCAL
PN_PREFIX
         ::= PN_CHARS_BASE ( ( PN_CHARS | '.' )* PN_CHARS )?
PN_CHARS_BASE
         ::= [A-Z]
           | [a-z]
           | [#xC0-#xD6]
           | [#xD8-#xF6]
           | [#xF8-#x2FF]
           | [#x370-#x37D]
           | [#x37F-#x1FFF]
           | [#x200C-#x200D]
           | [#x2070-#x218F]
           | [#x2C00-#x2FEF]
           | [#x3001-#xD7FF]
           | [#xF900-#xFDCF]
           | [#xFDF0-#xFFFD]
PN_CHARS ::= PN_CHARS_U
           | '-'
           | [0-9]
           | #xB7
           | [#x300-#x36F]
           | [#x203F-#x2040]
PN_CHARS_U
         ::= PN_CHARS_BASE
           | '_'
NODEID   ::= '_:' PN_LOCAL
ERROR    ::= .
_        ::= ' '
           | #xA
           | #x9
           | #xD
           | '//'
           | '"'
          /* ws: definition */
EOF      ::= $

permanent link

answered 12 Dec '12, 04:41

utapyngo's gravatar image

utapyngo
1.9k312
accept rate: 19%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×81
×31
×22
×3

question asked: 11 Dec '12, 02:55

question was seen: 1,146 times

last updated: 12 Dec '12, 04:41