SemwidgQL / EBNF

List of Production Rules

query = simpleQuery { '|' simpleQuery } ;

simpleQuery = resource [ '.' pathExpression ] ;

resource = namedResource | qualifiedResource | prefixedResource | forwardWildcard | forwardWildcardWithFilter ;

namedResource = Name ;

prefixedResource = NamespacePrefix Name ;

qualifiedResource = '<' Iri '>' ;

pathExpression = property { '.' property } [ '.' multiplePathExpression ] | multiplePathExpression ;

property = forwardProperty | forwardPropertyWithFilter | reversedProperty | reversedPropertyWithFilter | forwardWildcard | forwardWildcardWithFilter | reversedWildcard | reversedWildcardWithFilter ;

forwardProperty = qualifiedProperty | prefixedProperty ;

forwardPropertyWithFilter = qualifiedProperty '(' conditionalExpression ')' | prefixedProperty '(' conditionalExpression ')' ;

reversedProperty = '^' qualifiedProperty | '^' prefixedProperty ;

reversedPropertyWithFilter = '^' qualifiedProperty '(' conditionalExpression ')' | '^' prefixedProperty '(' conditionalExpression ')' ;

forwardWildcard = '*' ;

forwardWildcardWithFilter = '*' '(' conditionalExpression ')' ;

reversedWildcard = '^' '*' ;

reversedWildcardWithFilter = '^' '*' '(' conditionalExpression ')' ;

qualifiedProperty = '<' Iri '>' ;

prefixedProperty = NamespacePrefix Name ;

multiplePathExpression = '[' pathExpression { ',' pathExpression } ']' ;

conditionalExpression = conditionalOrExpression ;

conditionalOrExpression = conditionalAndExpression { ConditionalOr conditionalAndExpression } ;

conditionalAndExpression = expression { ConditionalAnd expression } ;

expression = relationalExpression | keywordExpression ;

relationalExpression = property { '.' property } [ relationalOperator numericExpression ] ;

numericExpression = additiveExpression ;

additiveExpression = multiplicativeExpression { additionalExpression } ;

multiplicativeExpression = unaryExpression { additionalUnaryExpression } ;

additionalExpression = '+' multiplicativeExpression | '-' multiplicativeExpression | numericLiteralPositive | numericLiteralNegative ;

additionalUnaryExpression = '*' unaryExpression | '/' unaryExpression ;

unaryExpression = '!' primaryExpression | '+' primaryExpression | '-' primaryExpression | primaryExpression ;

primaryExpression = forwardProperty | nestedQuery | stringLiteral | numericLiteral | BooleanLiteral ;

nestedQuery = '{' query '}' ;

stringLiteral = StringLiteral1 | StringLiteral2 ;

booleanLiteral = Boolean ;

numericLiteral = numericLiteralUnsigned | numericLiteralPositive | numericLiteralNegative ;

numericLiteralUnsigned = Integer | Decimal | DoubleValue ;

numericLiteralPositive = IntegerPositive | DecimalPositive | DoublePositive ;

numericLiteralNegative = IntegerNegative | DecimalNegative | DoubleNegative ;

keywordExpression = language | type | self | timeinterval | tinestart | timeend | aggregate | hide ;

language = '@lang' RelationalEqual stringLiteral ;

type = '@type' relationalEqualityOperator forwardProperty ;

self = '@type' relationalOperator numericExpression ;

timeinterval = '@timeinterval' RelationalEqual stringLiteral ;

timestart = '@timestart' RelationalEqual stringLiteral ;

timeend = '@timeend' RelationalEqual stringLiteral ;

aggregate = '@aggregate' RelationalEqual stringLiteral ;

hide = '@hide' RelationalEqual booleanLiteral ;

relationalOperator = RelationalEqual | RelationalNotEqual | RelationalGreater | RelationalGreaterEqual | RelationalLower | RelationalLowerEqual | ContainsOperator ;

relationalEqualityOperator = RelationalEqual | RelationalNotEqual ;

Integer = Digit { Digit } ;

IntegerPositive = '+' Integer ;

DecimalPositive = '+' Decimal ;

DoublePositive = '+' DoubleValue ;

IntegerNegative = '-' Integer ;

DecimalNegative = '-' Decimal ;

DoubleNegative = '-' DoubleValue ;

DoubleValue = Digit { Digit } '.' {Digit} Exponent | '.' Digit { Digit } Exponent | Digit { Digit } Exponent ;

Decimal = Digit { Digit } '.' {Digit} | '.' Digit { Digit } ;

StringLiteral1 = "'" { ( "#x0000..#EFFFF -( #x0027 | #x005C | #x000A | #x000D )" ) | EscapedChar } "'" ;

StringLiteral2 = '"' { ( "#x0000..#EFFFF -( #x0022 | #x005C | #x000A | #x000D )" ) | EscapedChar } '"' ;

Boolean = ('T'|'t') ('R'|'r') ('U'|'u') ('E'|'e') | ('F'|'f') ('A'|'a') ('L'|'l') ('S'|'s') ('E'|'e') ;

Name = ( NameCharWithUnderscore | Digit ) ( { CharValue } CharValue ) ;

NamespacePrefix = Prefix ':' ;

Prefix = NameChar { CharValue } ;

NameChar = 'A..Z' | 'a..z' | '\u00C0..\u00D6' | '\u00D8..\u00F6' | '\u00F8..\u02FF' | '\u0370..\u037D' | '\u037F..\u1FFF' | '\u200C..\u200D' | '\u2070..\u218F' | '\u2C00..\u2FEF' | '\u3001..\uD7FF' | '\uF900..\uFDCF' | '\uFDF0..\uFFFD' | '\u1000..\uEFFF' ;

CharValue = NameCharWithUnderscore | AdditionalNameChar | Digit | EscapedDot ;

NameCharWithUnderscore = NameChar | '_' ;

AdditionalNameChar = '\u00B7' | '\u0300..\u036F' | '\u203F..\u2040' | '-' ;

EscapedDot = '\.' ;

Exponent = ( 'e' | 'E' ) [ '+' | '-' ] Digit { Digit } ;

EscapedChar = '\t' | '\b' | '\n' | '\r' | '\f' | '\\' | '\"' | '\'' ;

ConditionalOr = '|' | '||' ;

ConditionalAnd = '&' | '&&' ;

RelationalEqual = '=' | '==' ;

RelationalNotEqual = '!=' ;

RelationalGreater = '>' ;

RelationalGreaterEqual = '>=' ;

RelationalLower = '<' ;

RelationalLowerEqual = '<=' ;

ContainsOperator = '~' ;

Digit = '0..9' ;

Iri = 'See RFC 3987 (http://www.ietf.org/rfc/rfc3987.txt)' ;