我从gov website获得了以下SPARQL查询:
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix sr: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/>
prefix ukhpi: <http://landregistry.data.gov.uk/def/ukhpi/>
prefix lrppi: <http://landregistry.data.gov.uk/def/ppi/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix lrcommon: <http://landregistry.data.gov.uk/def/common/>
# Returns the Price Paid data from the default graph for each transaction record having
# an address with the given postcode.
# The postcode to query is set using SPARQL 1.1's 'values' clause
SELECT ?paon ?saon ?street ?town ?county ?postcode ?amount ?date ?category
WHERE
{
VALUES ?postcode {"PL6 8RU"^^xsd:string}
?addr lrcommon:postcode ?postcode.
?transx lrppi:propertyAddress ?addr ;
lrppi:pricePaid ?amount ;
lrppi:transactionDate ?date ;
lrppi:transactionCategory/skos:prefLabel ?category.
OPTIONAL {?addr lrcommon:county ?county}
OPTIONAL {?addr lrcommon:paon ?paon}
OPTIONAL {?addr lrcommon:saon ?saon}
OPTIONAL {?addr lrcommon:street ?street}
OPTIONAL {?addr lrcommon:town ?town}
}
ORDER BY ?amount
目前,它仅检索邮政编码= PL6 8RU的记录。我想检索邮政编码以“ PL6”开头的所有记录。有什么想法吗?