forked from ldbc/ldbc_snb_interactive_v1_impls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbi-10.sparql
70 lines (69 loc) · 2.49 KB
/
bi-10.sparql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX sn: <http://www.ldbc.eu/ldbc_socialnet/1.0/data/>
PREFIX snvoc: <http://www.ldbc.eu/ldbc_socialnet/1.0/vocabulary/>
PREFIX sntag: <http://www.ldbc.eu/ldbc_socialnet/1.0/tag/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dbpedia: <http://dbpedia.org/resource/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?personId (?interestScore + ?messageScore AS ?score) (SUM( ?friendInterestScore + ?friendMessageScore) AS ?friendsScore)
WHERE
{
{
SELECT ?personId (MAX(COALESCE(?innerInterestScore,0)) AS ?interestScore) (COALESCE(COUNT(?message),0) AS ?messageScore)
WHERE
{
VALUES (?type) {(snvoc:Comment) (snvoc:Post)}
?personId a snvoc:Person .
{
?message a ?type .
?message snvoc:hasCreator ?personId .
?message snvoc:hasTag ?tag .
?tag foaf:name $tag .
?message snvoc:creationDate ?creationDate .
FILTER (?creationDate > $date)
}
UNION
{
?personId snvoc:hasInterest/foaf:name $tag
BIND(100 AS ?innerInterestScore)
}
}
GROUP BY ?personId
}
OPTIONAL {
{
SELECT ?friend (MAX(COALESCE(?friendInnerInterestScore,0)) AS ?friendInterestScore) (COALESCE(COUNT(?message),0) AS ?friendMessageScore)
WHERE
{
VALUES (?type) {(snvoc:Comment) (snvoc:Post)}
?friend a snvoc:Person .
{
?message a ?type .
?message snvoc:hasCreator ?friend .
?message snvoc:hasTag ?tag .
?tag foaf:name $tag .
?message snvoc:creationDate ?creationDate .
FILTER (?creationDate > $date)
}
UNION
{
?friend snvoc:hasInterest/foaf:name $tag
BIND(100 AS ?friendInnerInterestScore)
}
}
GROUP BY ?friend
}
{
?friend snvoc:knows/snvoc:hasPerson ?personId
}
UNION
{
?personId snvoc:knows/snvoc:hasPerson ?friend
}
}
}
GROUP BY ?personId ?interestScore ?messageScore ?friendsScore
ORDER BY DESC(?score + ?friendsScore) ?personId
LIMIT 100