In der Beispielabfrage binden die ersten fünf Dreifachmuster in der WHERE
-Klausel das Ergebnis an ein bestimmtes Ergebnis. Löschen Sie diese oder kommentieren Sie mit einem #
und Sie erhalten eine Liste aller Adressen bekannt zu dem gewählten SPARQL-Endpunkt erhalten:
prefix ...
SELECT ?item ?ppd_propertyAddress ?ppd_hasTransaction ?ppd_pricePaid ? ppd_transactionCategory ?ppd_transactionDate ?ppd_transactionId ?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> "paon: (12) AND street: (PATTINSON AND DRIVE)" .
#_: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> 3000000 .
#_:b1 <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:hasTransaction ?ppd_hasTransaction .
?item ppd:pricePaid ?ppd_pricePaid .
?item ppd:transactionCategory ?ppd_transactionCategory .
?item ppd:transactionDate ?ppd_transactionDate .
?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 }
}
LIMIT 100
Die zweite Frage ist unklar, und vielleicht durch die oben gelöst? I.e. Sie müssen nicht mehrere Abfragen senden.
Wenn Sie eine bestimmte Liste von Adressen abfragen möchten, können Sie einen Ausdruck SPARQL VALUES
verwenden, siehe VALUES: Providing inline data. Ein Ausgangspunkt kann die folgenden (durch Inspektion nur - Sie dies überprüfen, müsste gegen die Daten):
SELECT *
WHERE {
VALUES ?addr {"address1" "paon: (12) AND street: (PATTINSON AND DRIVE)" ...}
?ppd_propertyAddress text:query _:b0 .
_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ?addr .
?item ppd:propertyAddress ?ppd_propertyAddress .
...
}
Beachten Sie, dass VALUES
?addr
zu jeder Zeichenfolge in der Liste zwischen den Klammern in der VALUES
Klausel bindet. ?addr
wird dann im Dreifachmuster anstelle der Adresse in der ursprünglichen Abfrage verwendet.
Ich sehe nicht, welche Zeilen Sie mit "die ersten fünf Dreifachmuster in der WHERE-Klausel" meinen. Kannst du ein Beispiel mit ihnen kommentiert auskommen lassen? Es wäre auch sehr nützlich, die Umsetzung des Ausdrucks "VALUES" zu sehen. Um es klar zu sagen, möchte ich eine einzige Abfrage senden, die die Ergebnisse für 300 Adressen zurückgibt, die ich derzeit in einer CSV-Datei habe. – jds7117
Zu der Antwort hinzugefügt. Für 'VALUES' habe ich einen Link zur Verfügung gestellt, der Beispiele enthält. – scotthenninger
Ich kann Ihren Code nicht implementieren, ohne dass es bricht, und ich weiß nicht, wie Sie den Ausdruck "VALUES" entsprechend implementieren und zwei getrennte Adressen abfragen. – jds7117