My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
SPARQLASGrammar  
This page shows the grammar for SPARQLAS.
Updated Oct 9, 2010 by markschn...@gmail.com

Introduction

This page shows the complete grammar for SPARQLAS.

Grammar

cardinality := a nonempty finite sequence of digits between 0 and 9

lexical := a nonempty finite sequence of alphanumeric characters enclosed in a pair of ` (U+22) characters

variable := a nonempty finite sequence of alphanumeric characters starting with either a ? (U+3F) character or a $ (U+24) character

nodeID := a finite sequence of characters matching the BLANK_NODE_LABEL production of SPARQL

prefix := a finite sequence of characters matching the PNAME_NS production of SPARQL

fullIRI := an IRI as defined in RFC3987, enclosed in a pair of < (U+3C) and > (U+3E) characters

abbreviatedIRI := a finite sequence of characters matching the PNAME_LN production of SPARQL



IRI := fullIRI | abbreviatedIRI



OntologyDocument := [ QueryIRI ] { Import } { PrefixDefinition } Query

QueryIRI := 'IRI' '(' fullIRI ')'

Import := 'Import' '(' fullIRI ')'

PrefixDefinition := 'Namespace' '(' [ prefix ] '=' fullIRI ')'



Query := SelectQuery | ConstructQuery | AskQuery | DescribeQuery



SelectQuery := 'Select' [ variable { variable } | '*' ] 'Where' '(' { Atom } ')'

ConstructQuery := 'Construct' '(' { ConstructAtom } ')' 'Where' '(' { WhereAtom } ')'

AskQuery := 'Ask' 'Where' '(' { Atom } ')'

DescribeQuery := 'Describe' DescribeIRI | 'Describe' 'Where' '(' { Atom } ')'

ConstructAtom := Atom

WhereAtom := Atom

DescribeIRI := fullIRI



ClassVariable := variable

ObjectPropertyVariable := variable

DataPropertyVariable := variable

IndividualVariable := variable

LiteralVariable := variable



Class := IRI

Datatype := IRI

ObjectProperty := IRI

DataProperty := IRI

NamedIndividual := IRI

ConstrainingFacet := IRI

AnonymousIndividual := nodeID

NamedLiteral := lexical '^^' Datatype



Atom := Assertion | ClassAtom | ObjectPropertyAtom | DataPropertyAtom | HasKey | Declaration



Assertion := ClassAssertion | DirectType | ObjectPropertyAssertion | DataPropertyAssertion | NegativeObjectPropertyAssertion | NegativeDataPropertyAssertion | SameIndividual | DifferentIndividuals



ClassAssertion := ( 'ClassAssertion' | 'Type' ) '(' Individual ClassExpression ')'

DirectType := 'DirectType' '(' Individual ClassExpression ')'

ObjectPropertyAssertion := ( 'ObjectPropertyAssertion' | 'PropertyValue' ) '(' SourceIndividual ObjectPropertyExpression TargetIndividual ')'

DataPropertyAssertion := ( 'DataPropertyAssertion' | 'PropertyValue' ) '(' SourceIndividual DataPropertyExpression TargetValue ')'

NegativeObjectPropertyAssertion := ( 'NegativeObjectPropertyAssertion' | 'NegativePropertyValue' ) '(' SourceIndividual ObjectPropertyExpression TargetIndividual ')'

NegativeDataPropertyAssertion := ( 'NegativeDataPropertyAssertion' | 'NegativePropertyValue' ) '(' SourceIndividual DataPropertyExpression TargetValue ')'

SameIndividual := ( 'SameIndividual' | 'SameAs' ) '(' Individual Individual { Individual } ')'

DifferentIndividuals := ( 'DifferentIndividuals' | 'DifferentFrom' ) '(' Individual Individual { Individual } ')'

SourceIndividual := Individual

TargetIndividual := Individual

Individual := NamedIndividual | IndividualVariable | AnonymousIndividual

TargetValue := Literal

Literal := LiteralVariable | NamedLiteral



ClassAtom := SubClassOf | DirectSubClassOf | StrictSubClassOf | EquivalentClasses | DisjointClasses | DisjointUnion



SubClassOf := 'SubClassOf' '(' SubClassExpression SuperClassExpression ')'

DirectSubClassOf := 'DirectSubClassOf' '(' SubClassExpression SuperClassExpression ')'

StrictSubClassOf := 'StrictSubClassOf' '(' SubClassExpression SuperClassExpression ')'

EquivalentClasses := ( 'EquivalentClasses' | 'EquivalentTo' ) '(' ClassExpression ClassExpression { ClassExpression } ')'

DisjointClasses := ( 'DisjointClasses' | 'DisjointWith' ) '(' ClassExpression ClassExpression { ClassExpression } ')'

DisjointUnion := 'DisjointUnion' '(' DisjointClass DisjointClassExpression DisjointClassExpression { DisjointClassExpression } ')'

SubClassExpression := ClassExpression

SuperClassExpression := ClassExpression

DisjointClass := ClassVariable | Class

DisjointClassExpression := ClassExpression



ClassExpression := ClassVariable | Class | ObjectUnionOf | ObjectComplementOf | ObjectOneOf | ObjectIntersectionOf | ObjectAllValuesFrom | ObjectSomeValuesFrom | ObjectHasValue | ObjectMinCardinality | ObjectMaxCardinality | ObjectExactCardinality | DataAllValuesFrom | DataSomeValuesFrom | DataHasValue | DataMinCardinality | DataMaxCardinality | DataExactCardinality



ObjectUnionOf := ( 'ObjectUnionOf' | 'Or' ) '(' ClassExpression ClassExpression { ClassExpression } ')'

ObjectComplementOf := ( 'ObjectComplementOf' | 'Not' ) '(' ClassExpression ')'

ObjectOneOf := ( 'ObjectOneOf' | 'One' ) '(' Individual { Individual } ')'

ObjectIntersectionOf := ( 'ObjectIntersectionOf' | 'And' ) '(' ClassExpression ClassExpression { ClassExpression }')'

ObjectAllValuesFrom := ( 'ObjectAllValuesFrom' | 'All' ) '(' ObjectPropertyExpression ClassExpression ')'

ObjectSomeValuesFrom := ( 'ObjectSomeValuesFrom' | 'Some' ) '(' ObjectPropertyExpression ClassExpression ')'

ObjectHasValue := ( 'ObjectHasValue' | 'Has' ) '(' ObjectPropertyExpression Individual ')'

ObjectMinCardinality := ( 'ObjectMinCardinality' | 'Min' ) '(' cardinality ObjectPropertyExpression [ ClassExpression ] ')'

ObjectMaxCardinality := ( 'ObjectMaxCardinality' | 'Max' ) '(' cardinality ObjectPropertyExpression [ ClassExpression ] ')'

ObjectExactCardinality := ( 'ObjectExactCardinality' | 'Exact' ) '(' cardinality ObjectPropertyExpression [ ClassExpression ] ')'

DataAllValuesFrom := ( 'DataAllValuesFrom' | 'All' ) '(' DataPropertyExpression DataRange ')'

DataSomeValuesFrom := ( 'DataSomeValuesFrom' | 'Some' ) '(' DataPropertyExpression DataRange ')'

DataHasValue := ( 'DataHasValue' | 'Has' ) '(' DataPropertyExpression Literal ')'

DataMinCardinality := ( 'DataMinCardinality' | 'Min' ) '(' cardinality DataPropertyExpression [ DataRange ] ')'

DataMaxCardinality := ( 'DataMaxCardinality' | 'Max' ) '(' cardinality DataPropertyExpression [ DataRange ] ')'

DataExactCardinality := ( 'DataExactCardinality' | 'Exact' ) '(' cardinality DataPropertyExpression [ DataRange ] ')'



DataRange := !Datatype | DataUnionOf | DataComplementOf | DataOneOf | DataIntersectionOf | DatatypeRestriction



DataUnionOf := ( 'DataUnionOf' | 'Or' ) '(' DataRange DataRange { DataRange } ')'

DataComplementOf := ( 'DataComplementOf' | 'Not' ) '(' DataRange ')'

DataOneOf := ( 'DataOneOf' | 'One' ) '(' Literal { Literal } ')'

DataIntersectionOf := ( 'DataIntersectionOf' | 'And' ) '(' DataRange DataRange { DataRange } ')'

DatatypeRestriction := 'DatatypeRestriction' '(' Datatype FacetRestriction { FacetRestriction } ')'

FacetRestriction := ConstrainingFacet Literal



ObjectPropertyAtom := SubObjectPropertyOf | EquivalentObjectProperties | DisjointObjectProperties | ObjectPropertyDomain | ObjectPropertyRange | InverseObjectPropertyAtom | FunctionalObjectProperty | InverseFunctionalObjectProperty | ReflexiveObjectProperty | IrreflexiveObjectProperty | SymmetricObjectProperty | AsymmetricObjectProperty | TransitiveObjectProperty



SubObjectPropertyOf := ( 'SubObjectPropertyOf' | 'SubPropertyOf' ) '(' SubObjectPropertyExpression SuperObjectPropertyExpression ')'

EquivalentObjectProperties := ( 'EquivalentObjectProperties' | 'EquivalentProperty' ) '(' ObjectPropertyExpression ObjectPropertyExpression { ObjectPropertyExpression } ')'

DisjointObjectProperties := ( 'DisjointObjectProperties' | 'DisjointProperty' ) '(' ObjectPropertyExpression ObjectPropertyExpression { ObjectPropertyExpression } ')'

ObjectPropertyDomain := ( 'ObjectPropertyDomain' | 'Domain' ) '(' ObjectPropertyExpression ClassExpression ')'

ObjectPropertyRange := ( 'ObjectPropertyRange' | 'Range' ) '(' ObjectPropertyExpression ClassExpression ')'

InverseObjectPropertyAtom := ( 'InverseObjectProperties' | 'InverseOf' ) '(' ObjectPropertyExpression ObjectPropertyExpression ')'

FunctionalObjectProperty := 'FunctionalObjectProperty' '(' ObjectPropertyExpression ')'

InverseFunctionalObjectProperty := ( 'InverseFunctionalObjectProperty' | 'InverseFunctional' ) '(' ObjectPropertyExpression ')'

ReflexiveObjectProperty := ( 'ReflexiveObjectProperty' | 'Reflexive' ) '(' ObjectPropertyExpression ')'

IrreflexiveObjectProperty := ( 'IrreflexiveObjectProperty' | 'Irreflexive' ) '(' ObjectPropertyExpression ')'

SymmetricObjectProperty := ( 'SymmetricObjectProperty' | 'Symmetric' ) '(' ObjectPropertyExpression ')'

AsymmetricObjectProperty := ( 'AsymmetricObjectProperty' | 'Asymmetric' ) '(' ObjectPropertyExpression ')'

TransitiveObjectProperty := ( 'TransitiveObjectProperty' | 'Transitive' ) '(' ObjectPropertyExpression ')'

SubObjectPropertyExpression := ObjectPropertyExpression | ObjectPropertyChain

SuperObjectPropertyExpression := ObjectPropertyExpression

ObjectPropertyChain := ( 'ObjectPropertyChain' | 'Chain' ) '(' ObjectPropertyExpression ObjectPropertyExpression { ObjectPropertyExpression } ')'



ObjectPropertyExpression := ObjectPropertyVariable | ObjectProperty | InverseObjectProperty



InverseObjectProperty := ( 'ObjectInverseOf' | 'InverseOf' ) '(' ObjectPropertyExpression ')'



DataPropertyAtom := SubDataPropertyOf | EquivalentDataProperties | DisjointDataProperties | DataPropertyDomain | DataPropertyRange | FunctionalDataProperty



SubDataPropertyOf := ( 'SubDataPropertyOf' | 'SubPropertyOf' ) '(' SubDataPropertyExpression SuperDataPropertyExpression ')'

EquivalentDataProperties := ( 'EquivalentDataProperties' | 'EquivalentProperty' ) '(' DataPropertyExpression DataPropertyExpression { DataPropertyExpression } ')'

DisjointDataProperties := ( 'DisjointDataProperties' | 'DisjointProperty' ) '(' DataPropertyExpression DataPropertyExpression { DataPropertyExpression } ')'

DataPropertyDomain := ( 'DataPropertyDomain' | 'Domain' ) '(' DataPropertyExpression ClassExpression ')'

DataPropertyRange := ( 'DataPropertyRange' | 'Range' ) '(' DataPropertyExpression DataRange ')'

FunctionalDataProperty := 'FunctionalDataProperty' '(' DataPropertyExpression ')'

SubDataPropertyExpression := DataPropertyExpression

SuperDataPropertyExpression := DataPropertyExpression



DataPropertyExpression := DataPropertyVariable | DataProperty



HasKey := 'HasKey' '(' ClassExpression '(' { ObjectPropertyExpression } ')' '(' { DataPropertyExpression } ')' ')'



Declaration := ObjectPropertyDeclaration | DataPropertyDeclaration | NamedIndividualDeclaration | ClassDeclaration



ObjectPropertyDeclaration := 'ObjectProperty' '(' ObjectProperty | ObjectPropertyVariable ')'

DataPropertyDeclaration := 'DataProperty' '(' DataProperty | DataPropertyVariable ')'

NamedIndividualDeclaration := 'NamedIndividual' '(' NamedIndividual | IndividualVariable ')'

ClassDeclaration := 'Class' '(' Class | ClassVariable ')'


Sign in to add a comment
Powered by Google Project Hosting