# pSPARQL: A Querying Language for Probabilistic RDF Data

Authors: Hong Fang
Journal: Complexity
 (2019)

---

## Abstract

More and more linked data (taken as knowledge) can be automatically generated from nonstructured data such as text and image via learning, which are often uncertain in practice. On the other hand, most of the existing approaches to processing linked data are mainly designed for certain data. It becomes more and more important to process uncertain linked data in theoretical aspect. In this paper, we present a querying language framework for probabilistic RDF data (an important uncertain linked data), where each triple has a probability, called pSRARQL, built on SPARQL, recommended by W3C as a querying language for RDF databases. pSPARQL can support the full SPARQL and satisfies some important properties such as well-definedness, uniqueness, and some equivalences. Finally, we illustrate that pSPARQL is feasible in expressing practical queries in a real world.


---

## Body

## 1. Introduction

Resource Description Framework (RDF) [1] is the standard data model in the Semantic Web. In our real world, RDF data (as a knowledge base) possibly contains some uncertainty data due to the diversity of data sources, where RDF data are automatically extracted from different sources, such as YAGO [2]. For instance, some RDF data is generated from raw data via knowledge extraction and machine learning [3]. Indeed, uncertainty is generally a basic feature of data [4–6]. However, RDF model itself provides little support for uncertain data [7]. SPARQL [8], as a querying language for RDF data officially recommended by W3C [9], is unable to process uncertain data [4].There are many approaches to processing probabilistic RDF [10]. Reference [4] proposes a probabilistic model for SQL over relational data. Reference [5] presents a Bayesian network to represent probabilistic relations in RDF. Reference [11] develops a framework for evaluating SPARQL conjunctive queries (i.e., basic graph patterns, BGP) on RDF probabilistic databases. Reference [12] proposes answering SPARQL queries with RDFS reasoning on probabilistic models that encode statistical relationships among correlated triples, where the proposed probability models are based on either probability distribution function or a disjunctive normal form probability problem. Reference [13] presents effective pruning mechanisms, as well as structural and probabilistic pruning for query answering of SPARQL conjunctive queries (i.e., BGP) over probabilistic RDF data graphs. Reference [14] presents a RESCAL-based approach to query processing in relational data via factorization. Reference [14] presents a heuristic algorithm for query answering of SPARQL conjunctive queries (i.e., BGP) over incomplete and uncertain RDF. Reference [15] presents a framework for SPARQL query answering over probabilistic databases by extending the rich semantics offered by ontologies with probabilistic information. Reference [16] presents a probabilistic knowledge base system, ARCHIMEDESONE, for query answering with inference by scaling up the knowledge expansion and statistical inference algorithms. Reference [17] proposes a probabilistic automata-based framework of query evaluation in the presence of uncertainty efficiently.Although those approaches can query probabilistic RDF, most of them mainly process SPARQL conjunctive queries, that is, BGP queries. However, those existing probability models have little support for expressive operators (for instance, neither [13] nor [16] discusses OPTIONAL query for RDF) such as OPTIONAL, which is the least conventional operator of SPARQL [18], and DIFF, a difference operator in SPARQL 1.1 [19], which brings more expressivity [20].In this paper, we present an extended querying language (calledpSPARQL: probabilistic SPARQL) for probabilistic RDF databases with support of the full SPARQL fragment. We show that the semantics of pSPARQL can satisfy some important properties such as well-definedness, uniqueness, and some equivalences. Compared with the previous poster in ISWC 2016 [21], in this paper, we present a totally new probabilistic representation model and prove that the newly proposed model can preserve some important properties such as uniqueness and distributive law of equivalence.The remainder of this paper is structured as follows: the next section recalls RDF and SPARQL. Section3 introduces the syntax and semantics of pSPARQL and Section 4 discusses some important properties. Finally, we summarize our work in the last section.


## 2. RDF and SPARQL

In this section, we briefly recall the syntax and semantics of SPARQL. For more readings, please refer to the core SPARQL formalization in [22].


### 2.1. RDF Graphs

LetI and L be infinite sets ofIRIs andliterals, respectively, with I∩L=∅. Let U=I∪L. A triple (s,p,o)∈U×I×U is called anRDF triple. AnRDF graph is a finite set of RDF triples.


### 2.2. Syntax of SPARQL

LetV be a set ofvariables. SPARQLpatterns are inductively defined as follows:(i)
Any triple from(U∪V)×(I∪V)×(U∪V) is a pattern (called atriple pattern).(ii)
IfP1 and P2 are patterns, then so are the following: P1 UNION P2, P1 AND P2, P1 DIFF P2, and P1 OPT P2.(iii)
IfP is a pattern and F is a constraint (defined next), then P FILTER F is a pattern; we call F thefilter, which is a Boolean combination ofatomic constraints, one of the three following forms: bound(?x) (bound), ?x=?y (equality), and ?x=c (constant equality), for ?x,?y∈V and c∈U.


### 2.3. Semantics of SPARQL

Now, given a graphG and a pattern P, we define the semantics of P on G, denoted by PG, as a set of mappings (i.e., partial functions from V to U, in the following manner, where we use dom(μ) to denote the domain of μ)(i)
(u,v,w)G≔μ:u,v,w∩V→U∣μu,μv,μw∈G.(ii)
P1UNIONP2G≔P1G∪P2G.(iii)
P1ANDP2G=μ1∪μ2∣μ1∈P1Gandμ2∈P2Gandμ1~μ2.Here, two mappingsμ1 and μ2 are calledcompatible, denoted by μ1~μ2, if for any?x∈domμ1∩domμ2=∅,μ1?x=μ2?x.(iv)
P1DIFFP2G=μ1∈P1G¬∃μ2∈P2G,μ1~μ2}.(v)
P1OPTP2G=(P1ANDP2) UNION ((P1DIFFP2)G.(vi)
P1FILTERP2G≔μ∈P1G∣μF=true.Here, for any mappingμ and filter F, the evaluation of F on μ, denoted by μF, is defined in terms of a three-valued logic with truth valuestrue,false, anderror. Recall thatF is a Boolean combination of atomic constraints.For a bound constraintbound(?x), we define(1)μbound?x=trueif?x∈domμ;falseotherwise.For an equality constraint ?x=?y, we define(2)μ?x=?y=trueif?x,?y∈domμandμ?x=μ?y;falseif?x,?y∈domμandμ?x≠μ?y;errorotherwise.Thus, when ?x and ?y do not both belong to domμ, the equality constraint evaluates toerror. Similarly, for a constant-equality constraint ?x=c, we define(3)μ?x=c=trueif?x∈domμandμ?x=c;falseif?x∈domμandμ?x≠c;errorotherwise.A Boolean combination is evaluated using the truth tables given in Table 1.Table 1
Truth tables for the three-valued semantics.
(a) p q p ∧ q p ∨ q true true true true true false false true true error error true false true false true false false false false false error false error error true error true error false false error error error error error  (b) p ¬ p true false false true error error


## 2.1. RDF Graphs

LetI and L be infinite sets ofIRIs andliterals, respectively, with I∩L=∅. Let U=I∪L. A triple (s,p,o)∈U×I×U is called anRDF triple. AnRDF graph is a finite set of RDF triples.


## 2.2. Syntax of SPARQL

LetV be a set ofvariables. SPARQLpatterns are inductively defined as follows:(i)
Any triple from(U∪V)×(I∪V)×(U∪V) is a pattern (called atriple pattern).(ii)
IfP1 and P2 are patterns, then so are the following: P1 UNION P2, P1 AND P2, P1 DIFF P2, and P1 OPT P2.(iii)
IfP is a pattern and F is a constraint (defined next), then P FILTER F is a pattern; we call F thefilter, which is a Boolean combination ofatomic constraints, one of the three following forms: bound(?x) (bound), ?x=?y (equality), and ?x=c (constant equality), for ?x,?y∈V and c∈U.


## 2.3. Semantics of SPARQL

Now, given a graphG and a pattern P, we define the semantics of P on G, denoted by PG, as a set of mappings (i.e., partial functions from V to U, in the following manner, where we use dom(μ) to denote the domain of μ)(i)
(u,v,w)G≔μ:u,v,w∩V→U∣μu,μv,μw∈G.(ii)
P1UNIONP2G≔P1G∪P2G.(iii)
P1ANDP2G=μ1∪μ2∣μ1∈P1Gandμ2∈P2Gandμ1~μ2.Here, two mappingsμ1 and μ2 are calledcompatible, denoted by μ1~μ2, if for any?x∈domμ1∩domμ2=∅,μ1?x=μ2?x.(iv)
P1DIFFP2G=μ1∈P1G¬∃μ2∈P2G,μ1~μ2}.(v)
P1OPTP2G=(P1ANDP2) UNION ((P1DIFFP2)G.(vi)
P1FILTERP2G≔μ∈P1G∣μF=true.Here, for any mappingμ and filter F, the evaluation of F on μ, denoted by μF, is defined in terms of a three-valued logic with truth valuestrue,false, anderror. Recall thatF is a Boolean combination of atomic constraints.For a bound constraintbound(?x), we define(1)μbound?x=trueif?x∈domμ;falseotherwise.For an equality constraint ?x=?y, we define(2)μ?x=?y=trueif?x,?y∈domμandμ?x=μ?y;falseif?x,?y∈domμandμ?x≠μ?y;errorotherwise.Thus, when ?x and ?y do not both belong to domμ, the equality constraint evaluates toerror. Similarly, for a constant-equality constraint ?x=c, we define(3)μ?x=c=trueif?x∈domμandμ?x=c;falseif?x∈domμandμ?x≠c;errorotherwise.A Boolean combination is evaluated using the truth tables given in Table 1.Table 1
Truth tables for the three-valued semantics.
(a) p q p ∧ q p ∨ q true true true true true false false true true error error true false true false true false false false false false error false error error true error true error false false error error error error error  (b) p ¬ p true false false true error error


## 3. Probabilistic RDF and pSPARQL

In this section, we present probabilistic RDF and introduce the syntax and semantics of pSPARQL.


### 3.1. Probabilistic RDF

A probabilistic RDF R is a pair (G,ρ) where G is an RDF graph and ρ is a total function from G→(0,1]. Intuitively speaking, ρ is a probability function mapping each triple to a probability.For instance, letRJohn=(G,ρ) be a probabilistic RDF with G={t1,t2,t3} and ρ is a function from G→[0,1] defined in Table 2.Table 2 No Triple: (t) Probability:(ρ(t)) t 1 (John, sufferedFrom, Schizophrenia) 0.32  t 2 (John, sufferedFrom, MentalDisorder) 0.84  t 3 (John, Treatedby, Psychiatrist) 0.95Note that we assign a triple to a probability so that we could take triples as atoms in our scenario analogously treated in [13, 16]. This treatment is not direct to characterize the probability of subjects/objects in triples.


### 3.2. pSPARQL: A Probabilistic SPARQL

In this section, we introduce a probabilistic SPARQL (for short, pSPARQL).The Syntax of pSPARQL. The syntax of pSPARQL is slightly different from the syntax of SPARQL [22] in filters, where we newly introduce a fixed variable ?p to express constraints of probability.A probabilistic atomic filter is one of the four following forms:?p≥s,?p≤s,?p=s and ?p≠s, where s∈(0,1]. The filter of pSPARQL is a Boolean combination of atomic filters and probabilistic atomic filters.All patterns are called probabilistic patterns in pSPARQL.The Semantics of pSPARQL. The semantics of probabilistic patterns are defined in terms of sets of pairs of the form (μ,p) (called a solution (with probability), denoted by τ), where μ is a solution of probabilistic patterns and p∈(0,1]. Note that we only consider pairs of form (μ,p) where p>0.Now, given a probabilistic RDF graphR=(G,ρ) and a probabilistic pattern P, we define the semantics of P on R, denoted by PR, as a set of solutions with probability, in the following manner:(4)u,v,wR≔μ,p:u,v,w∩V→U∣μu,μv,μw∈Gandp=ρμu,μv,μw.P1UNIONP2R≔μ,p∣μ,p1∈P1Rorμ,p2∈P2Randp=maxp1,p2.By default, we set p=max⁡p.(5)P1ANDP2R≔μ1∪μ2,p∣μi,pi∈PiRi=1,2andp=maxμ1∪μ2=μi∪μj⁡min⁡pi,pj∣μi,pi∈P1Randμj,pj∈P2Randμi~μjP1DIFFP2R≔μ1,p1∈P1R∣¬∃μ2,p2∈P2Rs.t.μ1~μ2.P1OPTP2R=P1ANDP2UNIONP1DIFFP2R.P1FILTERFG≔τ=μ,p∈P1G∣τF=true.(i)
For a nonprobabilistic filterF, τF=μ(F).(ii)
For a Boolean combinationF, τF=μ(F).(iii)
For a probabilistic filter?p≥s, we define(6)τ?p≥s=trueifp≥s;falseotherwise.(iv)
For a probabilistic filter?p≤s, we define(7)τ?p≤s=trueifp≤s;falseotherwise.(v)
For a probabilistic filter?p=s, we define(8)τ?p=s=trueifp=s;falseotherwise.(vi)
For a probabilistic filter?p≠s, we define(9)τ?p≠s=trueifp≠s;falseotherwise.Example 1.
Given a patternP=?x,sufferFrom,?yFILTER? p≥0.5 (i.e., we query those persons who have suffered from some illness with probability over 0.5), we can compute that PRJohn={(μ,p)} where μ={?x→John,?y→Schizophrenia} and p=0.84. However, let τ=(?x→John,?y→Schizophrenia,0.32), τ∈PRJohn since τ?p≥0.5=false.Example 2.
Given a patternP=?x,sufferFrom,?y AND (?x,Treatedby,?z) (i.e., we query those who have suffered from some illness and have been treated), we can compute that PRJohn={τ1,τ2}, where(i)
τ1=(?x→John,?y→Schizophrenia,?z→Psychiatrist,0.32);(ii)
τ2=({?x→John,?y→MentalDisorder,?z→Psychiatrist},0.84).Example 3.
Given a patternP=?x,sufferFrom,SchizophreniaUNION (?x,Treatedby, Psychiatrist) (i.e., we query those who have suffered from schizophrenia or those who are treated by psychiatrists); we can compute that PRJohn={?x→John,0.95}}.Note that?p is slightly different from variables where the value of?p is variable via probability computation, while the value of other variables is fixed. Moreover, we disallow the comparison of probability in filters.


## 3.1. Probabilistic RDF

A probabilistic RDF R is a pair (G,ρ) where G is an RDF graph and ρ is a total function from G→(0,1]. Intuitively speaking, ρ is a probability function mapping each triple to a probability.For instance, letRJohn=(G,ρ) be a probabilistic RDF with G={t1,t2,t3} and ρ is a function from G→[0,1] defined in Table 2.Table 2 No Triple: (t) Probability:(ρ(t)) t 1 (John, sufferedFrom, Schizophrenia) 0.32  t 2 (John, sufferedFrom, MentalDisorder) 0.84  t 3 (John, Treatedby, Psychiatrist) 0.95Note that we assign a triple to a probability so that we could take triples as atoms in our scenario analogously treated in [13, 16]. This treatment is not direct to characterize the probability of subjects/objects in triples.


## 3.2. pSPARQL: A Probabilistic SPARQL

In this section, we introduce a probabilistic SPARQL (for short, pSPARQL).The Syntax of pSPARQL. The syntax of pSPARQL is slightly different from the syntax of SPARQL [22] in filters, where we newly introduce a fixed variable ?p to express constraints of probability.A probabilistic atomic filter is one of the four following forms:?p≥s,?p≤s,?p=s and ?p≠s, where s∈(0,1]. The filter of pSPARQL is a Boolean combination of atomic filters and probabilistic atomic filters.All patterns are called probabilistic patterns in pSPARQL.The Semantics of pSPARQL. The semantics of probabilistic patterns are defined in terms of sets of pairs of the form (μ,p) (called a solution (with probability), denoted by τ), where μ is a solution of probabilistic patterns and p∈(0,1]. Note that we only consider pairs of form (μ,p) where p>0.Now, given a probabilistic RDF graphR=(G,ρ) and a probabilistic pattern P, we define the semantics of P on R, denoted by PR, as a set of solutions with probability, in the following manner:(4)u,v,wR≔μ,p:u,v,w∩V→U∣μu,μv,μw∈Gandp=ρμu,μv,μw.P1UNIONP2R≔μ,p∣μ,p1∈P1Rorμ,p2∈P2Randp=maxp1,p2.By default, we set p=max⁡p.(5)P1ANDP2R≔μ1∪μ2,p∣μi,pi∈PiRi=1,2andp=maxμ1∪μ2=μi∪μj⁡min⁡pi,pj∣μi,pi∈P1Randμj,pj∈P2Randμi~μjP1DIFFP2R≔μ1,p1∈P1R∣¬∃μ2,p2∈P2Rs.t.μ1~μ2.P1OPTP2R=P1ANDP2UNIONP1DIFFP2R.P1FILTERFG≔τ=μ,p∈P1G∣τF=true.(i)
For a nonprobabilistic filterF, τF=μ(F).(ii)
For a Boolean combinationF, τF=μ(F).(iii)
For a probabilistic filter?p≥s, we define(6)τ?p≥s=trueifp≥s;falseotherwise.(iv)
For a probabilistic filter?p≤s, we define(7)τ?p≤s=trueifp≤s;falseotherwise.(v)
For a probabilistic filter?p=s, we define(8)τ?p=s=trueifp=s;falseotherwise.(vi)
For a probabilistic filter?p≠s, we define(9)τ?p≠s=trueifp≠s;falseotherwise.Example 1.
Given a patternP=?x,sufferFrom,?yFILTER? p≥0.5 (i.e., we query those persons who have suffered from some illness with probability over 0.5), we can compute that PRJohn={(μ,p)} where μ={?x→John,?y→Schizophrenia} and p=0.84. However, let τ=(?x→John,?y→Schizophrenia,0.32), τ∈PRJohn since τ?p≥0.5=false.Example 2.
Given a patternP=?x,sufferFrom,?y AND (?x,Treatedby,?z) (i.e., we query those who have suffered from some illness and have been treated), we can compute that PRJohn={τ1,τ2}, where(i)
τ1=(?x→John,?y→Schizophrenia,?z→Psychiatrist,0.32);(ii)
τ2=({?x→John,?y→MentalDisorder,?z→Psychiatrist},0.84).Example 3.
Given a patternP=?x,sufferFrom,SchizophreniaUNION (?x,Treatedby, Psychiatrist) (i.e., we query those who have suffered from schizophrenia or those who are treated by psychiatrists); we can compute that PRJohn={?x→John,0.95}}.Note that?p is slightly different from variables where the value of?p is variable via probability computation, while the value of other variables is fixed. Moreover, we disallow the comparison of probability in filters.


## 4. Well-Definedness, Uniqueness, and Equivalence of pSPARQL

In this section, we discuss some important properties of pSPARQL.Firstly, we introduce a property called well-definedness, which can ensure that the semantics of pSPARQL are well defined.Proposition 4 (well-definedness).
For any pSPARQL patternP, for any probabilistic RDF R, for any solution(μ,p)∈PR, we have p∈(0,1].Proof.
By induction on the structure ofP,ifP is a triple pattern (u,v,w), then p=(μu,μv,μw)∈(0,1];ifP is of the form P1UNIONP2, then let us discuss the three cases:(i)
ifμ,p∈P1R but μ,p∉P2R, then p∈(0,1];(ii)
ifμ,p∈P2R but μ,p∉P1R, then p∈(0,1];(iii)
ifμ,p∈P1R and μ,p∈P2R, then p=max⁡{p1,p2}∈(0,1] by induction.
IfP is of the form P1 AND P2, then this claim holds by induction, since there exists some solution (μ1,p1)∈P1R and some solution (μ2,p2)∈P2R with μ1~μ2 such that(10)μ=μ1∪μ2andp≥min⁡p1,p2andp=maxμ1∪μ2=μi∪μj⁡min⁡pi,pj∣μi,pi∈P1Randμj,pj∈P2Randμi~μj∈0,1.
IfP is of the form P1DIFFP2 or P1FILTERF, then this claim holds by induction, since(11)PR⊆P1R.
Finally, ifP is of the form P1OPTP2, then this claim holds by the cases of P1ANDP2, P1UNIONP2, and P1DIFFP2 by induction.Proposition 5 (uniqueness).
For any pSPARQL patternP, for any probabilistic RDF R, for any two solutions μ,p,(μ′,p′)∈PR, if μ=μ′, then p=p′.Proof.
By induction on the structure ofP, we have the following.
IfP is a triple pattern (u,v,w), then this claim directly holds by definition, since p1=p2=ρ(μu,μv,μw)).
IfP is of the form P1 UNION P2, then let us discuss the three cases:(i)
Ifμ,p∈P1R but μ,p∉P2R, then this claim holds by induction.(ii)
Ifμ,p∈P2R but μ,p∉P1R, then this claim holds by induction.(iii)
If there existμ,p1∈P1R and μ,p2∈P2R, then this claim holds by induction, since p=max⁡p1,p2.
IfP is of the form P1ANDP2, then this claim holds by induction, since there exists some solution μ1,p1∈P1R and some solution μ2,p2∈P2R with μ1~μ2 such that μ=μ1∪μ2 and =maxμ1∪μ2=μi∪μjmin⁡pi,pj∣(μi,pi)∈P1Rand(μj,pj)∈P2Randμi~μj. Therefore, p is unique.
IfP is of the form P1DIFFP2 or P1FILTERF, then this claim holds by induction, since(12)PR⊆P1R.
Finally, we discuss the equivalence of patterns in pSPARQL. LetP and Q be two patterns in pSPARQL. We say that P isequivalent to Q, denoted by P≡pQ, if for any probabilistic RDF R,PR=QR.Next, we show that pSPARQL satisfies the distributive law of equivalence, which is proven to be important in SPARQL.Proposition 6 (distributive law).
LetP1,P2, and P3 be three patterns in pSPARQL and let F be afilter. The following holds:(1)
(P1UNIONP2)   FILTER  F≡pP1FILTERFUNION(P2FILTERF);(2)
P1 AND P2UNIONP3≡pP1ANDP2UNION(P1ANDP3);(3)
(P1UNIONP2)ANDP3≡p(P1ANDP3)UNION(P2ANDP3);(4)
(P1UNIONP2)DIFFP3≡pP1DIFFP3UNION(P2DIFFP3);(5)
(P1UNIONP2)OPTP3≡pP1OPTP3UNION(P2OPTP3).Proof (sketch).
The first claim directly holds by the definition.
Now, we show the second item. LetR be a probabilistic RDF of the form (G,ρ). If (μ,p)∈P1AND(P2UNIONP3)R, then there must exist some solution (μ,p′)∈(P1ANDP2)UNION(P1ANDP3)R. By Proposition 5, we can conclude that p=p′. Then P1AND(P2UNIONP3R⊆(P1ANDP2)∪(P1UNIONP3R.
On the other hand,(μ,p)∈(P1ANDP2)∪(P1UNIONP3R; then there must exist some solution (μ,p′)∈P1AND(P2UNIONP3)R. By Proposition 5, we can conclude that p=p′. Then (P1ANDP2)∪(P1UNIONP3R⊆P1AND(P2UNIONP3R.
Analogously, we can prove the third item and the fourth item.
Finally, we could prove the fifth item by using the third item and the fourth item.


## 5. A Practical Example

In this section, we illustrate the application of pSPARQL in a real world via a practical example, where a probabilistic RDF is introduced in [11] shown in Figure 1.Figure 1
A virus RDF graphRrsv [11].Consider the following four queries (Q1, Q2, Q3, Q4) in pSPARQL.(1) Q1: What causes fatigue associated with some illness over 0.65 probability?Q1 is formally expressed in pSPARQL as follows:SELECT?x ((Fatigue,CauseOf,?x) AND ((?x,AssociatedWith,?z) FILTER?p >0.65).The solution of Q1 is as follows:(13)Q1Rrsv=?x→Flu,0.6.Note that (?x,AssociatedWith,?z)Rrsv = ?x→Flu,?z→Cough,0.7, ?x→Pneumonia,?z→Bronchitis,0.6. Thus ?x,AssociatedWith,?zFILTER?p>0.65Rrsv=(?x→Flu,?z→Cough,0.7). Then Q1Rrsv=?x→Flu,0.6, since Fatigue,CauseOf,?xRrsv=?x→Flu,0.6,?x→Pneumonie,0.6.(2) Q2: What are associated with cough over 0.7 probability?Q2 is formally expressed in pSRARQL as follows:SELECT?x ((?x,AssociatedWith,?y) FILTER?y = ‘Cough’ ∧?p >0.7).The solution of Q2 is as follows:(14)Q2Rrsv=?x→Bronchitis,?y→Cough,0.8.Note that(?x,AssociatedWith,?y)Rrsv is shown in Table 3.Table 3 ?x ?y ?p Bronchitis Cough 0.8  Bronchitis RSV 0.6  RSV Cough 0.7  Flu Cough 0.7  Pneumonia Bronchitis 0.6Thus?x,AssociatedWith,?yFILTER? y = ‘Cough’Rrsv = ?x→Bronchitis,?y→Cough,0.8, ?x→RSV,?y→Cough,0.7, ?x→Flu,?y→Cough,0.7.ThenQ2Rrsv=?x→Bronchitis,?y→Cough,0.8.(3) Q3: What is probability of bronchitis associated with cough directly or indirectly?Q3 is formally expressed as follows:SELECT?x ((?x,AssociatedWith,?y) UNION ((?x,AssociatedWith,?z) AND (?z,AssociatedWith,?y)) FILTER?x = ‘Bronchitis’∧?y = ‘Cough’).The solution of Q3 is as follows:(15)Q3Rrsv=?x→Bronchitis,?y→Cough,0.8.Note that ((?x,AssociatedWith,?y)Rrsv is shown in Table 4.Table 4 ?x ?y ?p Bronchitis Cough 0.8  Bronchitis RSV 0.6  RSV Cough 0.7  Flu Cough 0.7  Pneumonia Bronchitis 0.6Note that?x,AssociatedWith,?z) AND ?z,AssociatedWith,?yRrsv is shown in Table 5.Table 5 ?x ?y ?z ?p Bronchitis Cough RSV 0.6  Pneumonia Cough Bronchitis 0.6  Pneumonia RSV Bronchitis 0.6Thus?x,AssociatedWith,?y UNION ((?x,AssociatedWith,?z) AND ?z,AssociatedWith,?y)Rrsv is shown in Table 6.Table 6 ?x ?y ?z ?p Bronchitis Cough  0.8  Bronchitis RSV  0.6  RSV Cough  0.7  Flu Cough  0.7  Pneumonia Bronchitis  0.6  Bronchitis Cough RSV 0.6  Pneumonia Cough Bronchitis 0.6  Pneumonia RSV Bronchitis 0.6Then(16)Q3Rrsv=?x→Bronchitis,?y→Cough,0.8.(4) Q4: What are associated with cough excluding bronchitis?Q4 is expressed in pSPARQL as follows:SELECT?x (((?x,AssociatedWith,?y) FILTER?y = ‘Cough’) DIFF ((?x,AssociatedWith,?y) FILTER?x = ‘Bronchitis’ ∧?y = ‘Cough’)).The solution of Q4 is as follows:(17)Q4Rrsv=?x→Flu,?y→Cough,0.7.Note that (?x,AssociatedWith,?y)FILTER? y=‘Cough’Rrsv is shown in Table 7.Table 7 ?x ?y ?p Bronchitis Cough 0.8  RSV Cough 0.7  Flu Cough 0.7Note that?x,AssociatedWith,?yFILTER? x=′Bronchitis′∧?y=‘Cough’Rrsv is shown in Table 8.Table 8 ?x ?y ?p Bronchitis Cough 0.8ThenQ4Rrsv=?x→Flu,?y→Cough,0.7.In short, we could express many interesting queries with respect to probabilistic RDF via pSPARQL, which are useful in a practical world. Compared with SPARQL, where we obtain only connection via SPARQL querying, we could quantize the connection via pSPARQL, so that we could obtain more specific solutions.


## 6. Conclusions

In this paper, we extended SPARQL to support querying over probabilistic RDF. In the future, we will discuss some foundational properties of pSPARQL and implement it in a prototype to provide the full SPARQL query answering services for probabilistic RDF. As a future work, we are interested in presenting probabilistic semantics of RDF graphs in a unified framework, where many applications could be supported.



---

*Source: 8258197-2019-03-26.xml*