RDF Storage
The construction is described in the paper "Hypergraph Based Query Optimization", which we will use by translating the logic to OT circuits, starting with decryption into the circuit using the extended decryption process of the address content. We adopt their term definitions in this section, Query Planner, and Query Evaluator. their definitions provided here roughly verbatim for convenience:
Notation:
- RDF Graph –
G = (V, E)
whereV = {v|v ∈ S ∪ O}
andE = {e1, e2, ...}∃e = {u, v}
whereu, v ∈ V
. - Edge Labeling Function –
le(S, O) = P
. - Node Labeling Function –
lv(vt) = t
wheret ∈ (S ∪ O)
andS = Subject(URI ∪ BLANKS)
,P = Predicate(URI)
,O = Object(URI ∪ BLANKS ∪ LIT)
. - Hypergraph –
H(G) = (V, E)
where nodeV = {v1, ..., vn}
andE = {e1, ..., en}
whereV = {v|v ∈ S ∪ O ∪ P}
and each edgeE
is a non-empty set ofV . ∀P, ∃e|(Si, Oi) ∈ H(G)
where1 ≤ i ≤ n
. - Overlapping Hyperedge –
(hi(G) ⊑ hi+1(G))
whereh1(G) = (S1, P1, O1)
andh2(G) = (S2, P2, O2), (h1(G) ⊑ h2(G)) iff ∀s1 ∈ S1 ∈ h1(G)∃s2 ∈ S2 ∈ h2(G)∨∀o1 ∈ O1 ∈ h1(G)∃o2 ∈ O2 ∈ h2(G)∨∀p1 ∈ P1 ∈ h1(G)∃p2 ∈ P2 ∈ h2(G)
. - Predicate-Based Index –
I(G) = (V, E)
whereV = {v|v ∈ Pi ∈ hi ∧ δ}
andE = (vi, vj)
wherevi, vj ∈ V
and1 ≤ i ≤ n − 1, 1 ≤ j ≤ n
forδ ∈ V ∃e = (δ, v)
.δ
is the root of the index. - SPARQL Query –
QR
contains<Qq, Qs, Qp >
whereQq
is the query form andQp
is the match pattern if?x ∈ var(Qq)
then?x ∈ var(Qp)
andQs
contains constraints likeFILTER
,OPTIONAL
. - Query Graph –
QG = (V, E), V ← {var ∈ Qpi}
andE ← {P ∈ Qpi ∧ (var ∈ Qpi, var ∈ Qpi+1)}
where1 ≤ i ≤ n
,n
is the number of predicates,P
is the predicate. - Query Path –
Qpath∃Qpath, δ → Pi ∈ I(G)|Pi
.size = minsize ∧ (Pi → Pi+1) ∈ I(G) if ∃var ∈ Qpi == var ∈ Qpi+1
. - Data Insertion – Given
QR
andQp
then check∃Pi ∈ Qp ∈ I(G)
, if true then checkPi ∈ H(G) ∨ create hi ∈ Pi ∧ update H(G)
withhi
. Check if∃var ∈ Qp ∈ H(G)
, if true then overlaphi
withvar
’sh ∨ update hi
withvar ∈ Qp
. - Data Deletion – Given
QR
andQp
then check∃Pi ∈ Qp ∈ I(G) ∧ Pi ∈ var
, if true then check|hi| == 0
, if true then removevar ∈ Qp ∈ H(G) ∨
copy ofPi
exists.
Given these definitions, their paper proposes algorithms to perform the whole of the queries for this database:
Create Hypergraph:
- Given an RDF graph
G
as triple(S, O, P)
. V ← ∅, E ← ∅, ei ← ∅
∀(S, O, P) ∈ G, V ← V ∪ V ∈ (S ∪ O ∪ P)
.∀Pi|1 ≤ i ≤ n, 1 ≤ j ≤ n, ei ← {Pi, {Sj , Oj}}, E ← ei
.H(G) = (V, E)
.
Create Predicate-Based Index:
- Given a hypergraph
H(G)
. - Sort hyperedges by size.
∀hi|1 ≤ i ≤ n − 1
, ifMIN(size(hi))
thenI(G) = I(G) ∪ δ ↓ Pi, ∀j|i + 1 ≤ j ≤ n
, if(hi(G) ⊑ hj(G)) ∧ (size(Pi) == size(Pj))
thenI(G) = I(G) ∪ Pi ↔ Pj
elseI(G) = I(G) ∪ Pi → Pj
.