forked from ldbc/ldbc_snb_interactive_v1_impls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbi-3.sparql
34 lines (33 loc) · 1.39 KB
/
bi-3.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
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 ?tagName (SUM(?isFirstInt) AS ?countMonth1) (SUM(?isSecondInt) AS ?countMonth2) (ABS(?countMonth1 - ?countMonth2) AS ?diff)
WHERE
{
VALUES (?year1 ?month1) {($year $month)}
VALUES (?type) {(snvoc:Comment) (snvoc:Post)}
?message a ?type .
?message snvoc:hasTag/foaf:name ?tagName .
?message snvoc:creationDate ?creationDate .
BIND (year(?creationDate) AS ?year).
BIND (month(?creationDate) AS ?month).
BIND (((?month1 = ?month) && (?year1 = ?year)) AS ?isFirst)
BIND (
(
((?month1 != 12) && (?month = ?month1 + 1) && (?year = ?year1 )) ||
((?month1 = 12) && (?month = 1) && (?year = ?year1 + 1))
) AS ?isSecond
)
FILTER (?isFirst || ?isSecond) .
BIND (xsd:integer(?isFirst) AS ?isFirstInt) .
BIND (xsd:integer(?isSecond) AS ?isSecondInt)
}
GROUP BY ?tagName ?countMonth1 ?countMonth2
ORDER BY DESC(?diff) ?tagName
LIMIT 100