Hi I am using the SPARQL query from http://landregistry.data.gov.uk/app/qonsole
But I wish to also find out the property type (eg semi-detached, detached, etc.), if it is a new-build or not, the estate type (eg freehold or leasehold).
The SPARQL query I am using is,
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
Any help would be appreciated!
thank you
To get all available properties, the following query can be used:
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix lrppi: <http://landregistry.data.gov.uk/def/ppi/>
prefix lrcommon: <http://landregistry.data.gov.uk/def/common/>
SELECT DISTINCT ?p
WHERE
{
VALUES ?postcode {"PL6 8RU"^^xsd:string}
?transx lrppi:propertyAddress/lrcommon:postcode ?postcode ;
?p ?o
}
Among others, it shows the appropriate properties lrppi:estateType
and lrppi:propertyType
. Building the final query is rather simple, just add the triple patterns with those properties and select the variables:
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
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 ?estateType ?propertyType
WHERE
{
VALUES ?postcode {"PL6 8RU"^^xsd:string}
?addr lrcommon:postcode ?postcode.
?transx lrppi:propertyAddress ?addr ;
lrppi:pricePaid ?amount ;
lrppi:transactionDate ?date ;
lrppi:estateType ?estateType ;
lrppi:propertyType ?propertyType ;
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.