-
Notifications
You must be signed in to change notification settings - Fork 7
/
paper-mapping.rq
45 lines (36 loc) · 1.35 KB
/
paper-mapping.rq
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
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX schema: <http://schema.org/>
PREFIX d2r2p: <https://2023.d2r2.aksw.org/#>
CONSTRUCT {
<https://2023.d2r2.aksw.org/#submissions>
schema:subEvent ?paperIri .
?paperIri a schema:Event ;
dct:title ?title ;
dct:identifier ?paperId ;
schema:performer ?authorCollectionIri .
?authorCollectionIri ?authorMember ?authorIri .
?authorIri a foaf:Person ;
foaf:name ?authorName .
}
#SELECT ?entry ?id ?paper
WHERE {
BIND(STRDT(url:text(</data/metadata.json>), xsd:json) AS ?json)
BIND(json:entries(?json) AS ?entries)
?entries json:unnest (?entry ?i)
BIND(json:path(?entry, "$.key") AS ?paperId)
BIND(json:path(?entry, "$.value") AS ?content)
BIND(IRI(CONCAT(STR(d2r2p:), ?paperId)) AS ?paperIri)
BIND(json:path(?content, "$.title") AS ?title)
BIND(IRI(CONCAT(STR(?paperIri), "-authors")) AS ?authorCollectionIri)
LATERAL {
BIND(json:path(?content, "$.authors") AS ?authors)
?authors json:unnest (?author ?authorIdx) .
BIND(json:path(?author, "$.name") AS ?authorName)
optional {
?authorIriRaw foaf:name ?authorName .
}
BIND(IF(BOUND(?authorIriRaw), ?authorIriRaw, IRI(CONCAT(STR(d2r2p:), ENCODE_FOR_URI(?authorName)))) AS ?authorIri)
BIND(IRI(CONCAT(STR(rdf:), "_", STR(?authorIdx + 1))) AS ?authorMember)
}
}