我有一个三元组商店,想创建一个查询。这是代表单个契约的资源的示例:
<http://natarchives.com.mt/deed/MS588-D52>
locah:accessProvidedBy <http://natarchives.com.mt/repository/MT01> ;
locah:associatedWith "heredes" , "honorabilis" , "uncias" , "per tactum penne" , "vinea" , "ut moris est" , "juribus" , "unciarum" , "precij" , "spacium" , "gracia" , "tabernam sitam" , "honorabili" , "renunciantes" , "territorio" , "testes" , "tarenos" , "recuperacionis consuetudinarie" , "positam" , "ponderis" , "post" , "tabernam" , "causa" , "per se" , "sed sponte jure" , "diaconus" , "cisterna" , "precio" , "civitate" , "festo" , "solvere" ;
locah:associatedWith <http://natarchives.com.mt/person/person11817> , <http://natarchives.com.mt/person/person11826> , <http://natarchives.com.mt/person/person11822> , <http://natarchives.com.mt/person/person11820> , <http://natarchives.com.mt/person/person11823> , <http://natarchives.com.mt/person/person11818> , <http://natarchives.com.mt/place/place486> , <http://natarchives.com.mt/person/person11824> , <http://natarchives.com.mt/person/person11825> , <http://natarchives.com.mt/person/person11821> , <http://natarchives.com.mt/person/person11816> , <http://natarchives.com.mt/place/place886> , <http://natarchives.com.mt/person/person11819> ;
locah:level <http://data.archiveshub.ac.uk/page/level/item> ;
dcterms:date "1-10-1467" ;
dcterms:identifier "MS588-D52" ;
dcterms:isPartOf <http://natarchives.com.mt/archivalresource/MS588> ;
dcterms:type "Emptio" .
我正在尝试按日期搜索契约。结果应显示:
契约ID,类型,注册URI-在这种情况下(http://natarchives.com.mt/archivalresource/MS588),注册ID,存储库URI(http://natarchives.com.mt/repository/MT01),存储库名称,与契约关联的关键字以及与契约关联的人员和地点契据。对于人和地方,我想获得其他属性,例如名称,姓氏。这是我到目前为止的内容:
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX locah: <http://data.archiveshub.ac.uk/def/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX schema: <http://schema.org/>
SELECT ?id ?type ?register ?regId ?rep ?repName ?associatedEntities
WHERE
{
{
{
SELECT ?id ?type ?register ?regId ?rep ?repName (group_concat(concat(str(?places)," @ ",?placeName); separator=" | ") as ?associatedEntities)
WHERE {
?x dcterms:date "22-1-1487".
?x dcterms:identifier ?id.
?x dcterms:type ?type.
?x locah:associatedWith ?places.
?places schema:name ?placeName.
?x dcterms:isPartOf ?register.
?register dcterms:identifier ?regId.
?x locah:accessProvidedBy ?rep.
?rep rdfs:label ?repName.
FILTER (isURI(?places)).
}
GROUP BY ?id ?type ?register ?regId ?rep ?repName
}union{
SELECT ?id ?type ?register ?regId ?rep ?repName (group_concat(concat(str(?persons)," @ ",?name); separator=" | ") as ?associatedEntities)
WHERE {
?x dcterms:date "22-1-1487".
?x dcterms:identifier ?id.
?x dcterms:type ?type.
?x locah:associatedWith ?persons.
?persons foaf:firstName ?name.
?x dcterms:isPartOf ?register.
?register dcterms:identifier ?regId.
?x locah:accessProvidedBy ?rep.
?rep rdfs:label ?repName.
FILTER (isURI(?persons)).
}
GROUP BY ?id ?type ?register ?regId ?rep ?repName
}
}
}
我设法同时获得了两者,但有可能对联合的结果进行分组