Skip to content

Instantly share code, notes, and snippets.

@mtravis
Last active August 29, 2015 14:13
Show Gist options
  • Save mtravis/bfaa0b27fb35bb246990 to your computer and use it in GitHub Desktop.
Save mtravis/bfaa0b27fb35bb246990 to your computer and use it in GitHub Desktop.
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 lrhpi: <http://landregistry.data.gov.uk/def/hpi/>
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/>
PREFIX text: <http://jena.apache.org/text#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ppd: <http://landregistry.data.gov.uk/def/ppi/>
PREFIX lrcommon: <http://landregistry.data.gov.uk/def/common/>
SELECT ?ppd_transactionDate ?ppd_pricePaid ?ppd_publishDate ?ppd_estateType ?ppd_newBuild ?ppd_propertyAddressCounty ?ppd_propertyAddressDistrict ?ppd_propertyAddressLocality ?ppd_propertyAddressPaon ?ppd_propertyAddressPostcode ?ppd_propertyAddressSaon ?ppd_propertyAddressStreet ?ppd_propertyAddressTown ?ppd_propertyType ?ppd_recordStatus
WHERE
{ ?ppd_propertyAddress text:query _:b0 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> lrcommon:county .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "( City AND of AND Plymouth )" .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b2 .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> 3000000 .
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
?item ppd:propertyAddress ?ppd_propertyAddress .
?item ppd:transactionDate ?ppd_transactionDate .
?item ppd:hasTransaction ?ppd_hasTransaction .
?item ppd:pricePaid ?ppd_pricePaid .
?item ppd:publishDate ?ppd_publishDate .
?item ppd:transactionId ?ppd_transactionId
OPTIONAL
{ ?item ppd:estateType ?ppd_estateType }
OPTIONAL
{ ?item ppd:newBuild ?ppd_newBuild }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:county ?ppd_propertyAddressCounty }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:district ?ppd_propertyAddressDistrict }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:locality ?ppd_propertyAddressLocality }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:paon ?ppd_propertyAddressPaon }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:postcode ?ppd_propertyAddressPostcode }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:saon ?ppd_propertyAddressSaon }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:street ?ppd_propertyAddressStreet }
OPTIONAL
{ ?ppd_propertyAddress lrcommon:town ?ppd_propertyAddressTown }
OPTIONAL
{ ?item ppd:propertyType ?ppd_propertyType }
OPTIONAL
{ ?item ppd:recordStatus ?ppd_recordStatus }
FILTER ( ?ppd_transactionDate >= "2014-01-01"^^xsd:date )
FILTER ( ?ppd_transactionDate <= "2014-12-31"^^xsd:date )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment