Dear list,

Hi,
I am wondering whether the following SPARQL query can be more optimized. It
calculates a summation of (2P(E)P(E|C)-P(E|C)^2), given concept C, such as "
http://dbpedia.org/class/yago/PhysicalEntity100001930"; shown below.
I know this is not exactly related to this list, but still want to seek
some helps here, sorry for this.

select (sum(?subTotal) as ?sum) where {
 {select ((2*count(?inst)*?countec/?countc -
?countec/?countc*?countec/?countc) as ?subTotal)
 where {
 ?inst <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://dbpedia.org/class/yago/PhysicalEntity100001930>.
 {select (count(?inst1) as ?countc) ?c ?countec
 where{
 ?inst1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?c.
 {select (count(?inst) as ?countec) ?c
 WHERE{
 ?inst <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://dbpedia.org/class/yago/PhysicalEntity100001930>;
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?c.
 filter (str(?c)!= "http://dbpedia.org/class/yago/PhysicalEntity100001930";)
 } GROUP BY ?c } }
 GROUP BY ?c ?countec }} group by ?countc ?countec }}

thanks,
June

Reply via email to