-
Notifications
You must be signed in to change notification settings - Fork 0
/
generic_listendpoint.sparql
64 lines (60 loc) · 2.99 KB
/
generic_listendpoint.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
#+ endpoint_in_url: False
#+ pagination: 50
#+ transform: {
#+ "label": "?entityLabelNew",
#+ "uri": "?entityReturn",
#+ "type": "?entityTypeLabel",
#+ "source": "?source",
#+ "birth": "?birth",
#+ "death": "?death",
#+ "occupation": "?occupation",
#+ "$anchor": "uri"
#+ }
PREFIX bds: <http://www.bigdata.com/rdf/search#>
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
PREFIX bioc: <http://ldf.fi/schema/bioc/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX idm: <https://www.intavia.org/idm/>
PREFIX : <http://www.researchspace.org/resource/>
PREFIX idmcore: <https://www.intavia.org/idm-core/>
PREFIX idmcore2: <http://www.intavia.eu/idm-core/>
SELECT DISTINCT ?entityReturn (GROUP_CONCAT(?entityLabel; SEPARATOR=";") as ?entityLabelNew) (SAMPLE(?entityTypeLabel) as ?entityTypeLabel) (SAMPLE(?source) AS ?source) (SAMPLE(?birth) AS ?birth) (SAMPLE(?death) AS ?death) (GROUP_CONCAT(?occupation; SEPARATOR=";") as ?occupation)
WHERE {
?entity crm:P1_is_identified_by ?appellation .
?entity idmcore:person_proxy_for|idmcore2:person_proxy_for|idmcore:group_proxy_for|idmcore2:group_proxy_for ?entityReturn .
?entity a ?entityType .
?entityReturn a ?entityType2 .
{?appellation a crm:E33_E41_Linguistic_Appellation .}
UNION
{?appellation a crm:E41_Appellation .}
?appellation rdfs:label ?entityLabel .
SERVICE <http://www.bigdata.com/rdf/search#search> {
?entityLabel bds:search ?_q
}
FILTER (?entityType IN(<https://www.intavia.org/idm-core/Person_Proxy>, <http://www.intavia.eu/idm-core/Person_Proxy>,
<https://www.intavia.org/idm-core/Group>, <http://www.cidoc-crm.org/cidoc-crm/E53_Place>
))
FILTER (?entityType2 IN(<http://www.intavia.eu/idm-core/Provided_Person>, <https://www.intavia.org/idm-core/Provided_Person>,
<https://www.intavia.org/idm-core/Provided_Group>, <http://www.cidoc-crm.org/cidoc-crm/E53_Place>
))
BIND (
IF(?entityType2 IN(<http://www.intavia.eu/idm-core/Provided_Person>, <https://www.intavia.org/idm-core/Provided_Person>), "Person",
IF(?entityType2 = <https://www.intavia.org/idm-core/Group>, "Institution",
IF(?entityType2 = <http://www.cidoc-crm.org/cidoc-crm/E53_Place>, "Place", "Entity"))) AS ?entityTypeLabel)
BIND (
IF(STRSTARTS(STR(?entityReturn), "http://data.biographynet.nl/"), "BiographyNet",
IF(STRSTARTS(STR(?entityReturn), "http://www.intavia.eu/person/"), "APIS",
IF(STRSTARTS(STR(?entityReturn), "http://www.intavia.eu/provided_person/bs/"), "BiographySampo", "unknown"))) AS ?source)
OPTIONAL {
?birthEvent crm:P98_brought_into_life ?entity ;
(crm:P4_has_time-span|crm:P4_has_time_span)/rdfs:label ?birth .
}
OPTIONAL {
?deathEvent crm:P100_was_death_of ?entity ;
(crm:P4_has_time-span|crm:P4_has_time_span)/rdfs:label ?death .
}
OPTIONAL {
?entity bioc:has_occupation/rdfs:label ?occupation .
}
}
GROUP BY ?entityReturn