Query ::= Fetch | Assert | Retract | Infer Assert ::= 'assert' Phrase Retract ::= 'retract' Phrase Infer ::= 'infer' Constraint 'when' Phrase Fetch ::= 'fetch' ( Number? Type | Procedure ) Where Using? Where ::= 'where'? Phrase Using ::= 'using' Namespace ( ',' Namespace )* Phrase ::= Constraint ( Conjunction Phrase )* Constraint ::= Subject? Negation? Predicate Object Conjunction ::= Disjoint | Conjoint Negation ::= 'not' Disjoint ::= ',' | 'and' Conjoint ::= 'or' Subject ::= Variable | URI | Procedure Predicate ::= Identifier | '=' | '!=' | '<' | '>' | '<=' | '>=' | '~' Object ::= Subject | Type | Literal Type ::= URI Literal ::= String | Number String ::= '"' /.+?/ '"' Number ::= /-?\d+(.\d+)*/ Procedure ::= Identifier '(' Object ( ',' Object )* ')' Namespace ::= Identifier URI Variable ::= '?' Identifier Identifier ::= /\w\S*/ URI ::= /\w+:\S+/