RQL v2.1 Typing Rules
RDFSuite
Overview
Download RQL
Instructions
Documentation
Manual
Query Expression Typing Rules sub/superClassOf(1)
e:t,t{tC, tM}, e'{subClassOf,superClassOf} e'(e):{t} (1) sub/superClassOf(2)
e1: t, t {tC, tM}, e2: integer, e'{subClassOf, superClassOf} e'(e1, e2):{t} (2) sub/superPropertyOf(1)
e:tP[t1,t2], e'{subPropertyOf, superPropertyOf} e'(e):{tP[t1,t2]} (3) sub/superPropertyOf(2)
e1: tP[t1,t2], e2: integer, e'{subPropertyOf, superPropertyOf} e'(e1, e2):{tP[t1,t2]} (4) top/leafclass
e{topclass, leafclass} e:{tC} (5) top/leafproperty
e{topproperty, leafproperty} e:{tP[t1,t2]} (6) domain
e:tP[t1,t2], t1 {tC, tM} domain(e): t1 (7) range
e:tP[t1,t2], t2 {tC, tM, tL} range(e): t2 (8) typeof
e:t, (t = tU | t {tC, tP[t1,t2]} typeof(e): ({tC} | {tM}) (9) namespace
e:t, t{tC, tM, tP[t1,t2], tL} namespace(e): {tU} (10)
Table 1: Schema Operations
Note that the rules depicted in Figures 1 and 2 do not apply in cases where some of the parameter(s) has a union type. Figure 3 illustrates the appropriate rules for the most important operations that may be applied on union types. In these rules we use the coerce function, which returns the types of the given expression for which the corresponding operation is defined.
Query Expression Typing Rules count
e:{t} count(e): integer (1) min, max
e:{t}, t{integer, float, date}, e'{min, max} e'(e): t (2) avg, sum
e:{t}, t{integer, float}, e'{avg, sum} e'(e): t (3) bag
e1: t, e2: t, ..., en: t bag(e1, e2, ..., en): {t} (4) seq
e1: t1, e2:t2, ..., en:tn seq(e1, e2, ..., en): [t1, t2, ..., tn] (5) ith
e:[t1, t2, ..., tn], i:integer, i[1..n] (e[i]):ti (6) in
e:t, e': {t} (e in e'):boolean (7) set operations
e1: {t}, e2: {t'}, t = t', q = {intersect, union, minus} (e1 q e2):{t} (8) comp
e:t, e':t', t = t', q(=, !=, <, >, , , like) (e q e'):boolean (9) ^name
e:t, t{tC, tM, tP[t1,t2]} ^e: {eval(t)}(10)
Table 2: Data Operations
Union Type Expression Typing Rules
sub/super ClassOfU
e:(t1+t2+? +tn), $ i[1... n], ti{tC, tM} e'{subClassOf, superClassOf}, e'(e): {Si(ti)}, coerce(e): Si(ti) (1) inbagU
e: t, e': {(t'1 + t'2 + ?+ t'n)}, $ i[1 ... n], t'i = t (e in e'):boolean, coerce(e'): {t} (2) Uinbag
e: (t1 + t2 + ? +tn), e': {t'}, $ i[1... n], ti = t' (e in e'):boolean, coerce(e): t' (3) UinbagU
e:(t1+t2+?+tn), e':{(t'1+t'2+?+t'm)}, $ i[1... n], j[1... m], k[1... l], ti = t'j (= t'k) (e in e'):boolean, coerce(e):Sk(t'k),coerce(e'):{Sk(t'k)} (4) Uintersect
e:{(t1 + t2 + ?+ tn)}, e':{t'},$ i[1 ... n],ti = t' (e intersect e'):{t'}, coerce(e): {t'} (5) UintersectU
e:{(t1+t2+?+tn)}, e':{(t'1+t'2+?+t'm)}, $ i[1... n], j[1... m], k[1... l], ti = t'j (= t'k) (e intersect e'):{Sk(t'k)}, coerce(e):{Sk(t'k)}, coerce(e'):{Sk(t'k)} (6) Uminus
e:{(t1+t2+?+tn)}, e':{t'},$ i[1... n], ti = t' (e minus e'):{(t1+t2+?+tn)} (7) minusU
e: {t}, e': {(t'1 + t'2 + ? + t'n)},$ i[1... n], t'i = t (e minus e'):{t}, coerce(e'): {t} (8) UminusU
e: {(t1 + t2 + ? + tn)}, e': {(t'1 + t'2 + ? + t'm)} $ i[1... n], j[1... m], k[1... m], ti = t'j (= t'k) (e minus e'):{(t1 + t2 + ? + tn)} (9) Uunion
e: {(t1 + t2 + ? + tn)}, e': {t'} (e union e'):{(Si(ti) + t')} (10) UunionU
e: {(t1 + t2 + ? + tn)}, e': {(t'1 + t'2 + ? + t'm)} (e union e'):{(Si(ti) + Sj(t'j))} (11) Ucomp
e:(t1+t2+?+tn), e':t', q{=, !=, <, >, , , like}, $i[1... n] , ti=t' (e q e'):boolean, coerce(e):t' (12) UcompU
e:(t1 + t2 + ? + tn), e':(t'1 + t'2 + ? + t'm), $ i[1... n], j[1... m], k[1... m], ti = t'j (= t'k), q (=, !=, <, >, , , like) (e q e'):boolean, coerce(e):Sk(t'k), coerce(e'):Sk(t'k) (13)
Table 3: Union type coercions
Path Expression Typing Rules
Data Paths
e:t, t{tC, tM}, eval(e):t' (select x from e{x}): {t'}, x:t' (1)
e:tP[t1,t2], eval(t1):t'1, eval(t2):t'2 (select x,y from {x}e{y}):{[t'1,t'2]}, x:t'1, y:t'2 (2)
e:{t} (select x from e{x}): {t}, x:t (3)
Schema Paths
e:tP[tC,tC] (select $c1,$c2 from {$c1}e{$c2}):{[tC,tC]}, $c1:tC, $c2:tC (4)
e:tP[t1,t2] (select $$c1,$$c2 from {$$c1}e{$$c2}):{[t1,t2]}, $$c1:t1,$$c2:t2 (5)
Mixed Paths
e:tP[tC,tC] (select $c1, x, $c2, y from {x;$c1}e{y;$c2}): {[tC, tU, tC, tU]}, $c1:tC, x:tU, $c2:tC, y:tU (6)
e:tP[t1,t2], eval(t1):t'1, eval(t2):t'2 (select $$c1, x, $$c2, y from {x;$$c1}e{y;$$c2}): {[t1, t'1, t2, t'2]}, $$c1:t1, x:t'1, $$c2:t2, y:t'2 (7)
Table 4: Basic Filters
This document was translated from LATEX by HEVEA.
Last modified: February 14, 2003