Knowledge
lawn is wet today if it rained last night
Fact
we found lawn was wet this morning
Infer
it rained last night
is this belong to SWRL?
what should i read or check to easily understand these ?
I've figured it out, i paste a turtle syntax file.
To do this we have to make some Object (Predict) Properties.
hasFact
previousDay
nextDay (inverseOf previousDay)
Then add some Individuals like :
URIs:
wet, rain, today, yesterday
assert today previousDay yesterday and today hasFact wet, next go to swrl tab add this rule.
hasFact(?today, wet) ^ previousDay(?today, ?yesterday) -> hasFact(?yesterday, rain)
Start REASONING it will work.
#prefix : <http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix xml: <http://www.w3.org/XML/1998/namespace> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#base <http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31> .
<http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31> rdf:type owl:Ontology .
#################################################################
# Annotation properties
#################################################################
### http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled
<http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> rdf:type owl:AnnotationProperty .
#################################################################
# Object Properties
#################################################################
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#hasFact
:hasFact rdf:type owl:ObjectProperty .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#nextDay
:nextDay rdf:type owl:ObjectProperty ;
owl:inverseOf :previousDay .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#previousDay
:previousDay rdf:type owl:ObjectProperty .
#################################################################
# Data properties
#################################################################
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#hasValue
:hasValue rdf:type owl:DatatypeProperty ;
rdfs:range [ rdf:type rdfs:Datatype ;
owl:oneOf [ rdf:type rdf:List ;
rdf:first "rain" ;
rdf:rest [ rdf:type rdf:List ;
rdf:first "wet" ;
rdf:rest rdf:nil
]
]
] .
#################################################################
# Classes
#################################################################
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#Day
:Day rdf:type owl:Class .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#ItRainsLastNight
:ItRainsLastNight rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Restriction ;
owl:onProperty :previousDay ;
owl:someValuesFrom [ rdf:type owl:Restriction ;
owl:onProperty :hasFact ;
owl:hasValue :rain
]
] ;
rdfs:subClassOf :Phenomenon .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#Phenomenon
:Phenomenon rdf:type owl:Class .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#Today
:Today rdf:type owl:Class ;
rdfs:subClassOf :Day .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#Weather
:Weather rdf:type owl:Class .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#Yesterday
:Yesterday rdf:type owl:Class ;
rdfs:subClassOf :Day .
#################################################################
# Individuals
#################################################################
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#rain
:rain rdf:type owl:NamedIndividual ,
:Weather ;
:hasValue "rain"^^xsd:string .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#today2018614
:today2018614 rdf:type owl:NamedIndividual ,
:Today ;
:hasFact :wet ;
:previousDay :yesterday2018613 .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#wet
:wet rdf:type owl:NamedIndividual ,
:Phenomenon ;
:hasValue "wet"^^xsd:string .
### http://www.semanticweb.org/monsterstep/ontologies/2018/5/untitled-ontology-31#yesterday2018613
:yesterday2018613 rdf:type owl:NamedIndividual ,
:Yesterday .
#################################################################
# Rules
#################################################################
<today> rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
<yesterday> rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
[ <http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> "true"^^xsd:boolean ;
rdfs:comment ""^^xsd:string ;
rdfs:label "ItRainsLastNight"^^xsd:string ;
rdf:type <http://www.w3.org/2003/11/swrl#Imp> ;
<http://www.w3.org/2003/11/swrl#body> [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#IndividualPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :hasFact ;
<http://www.w3.org/2003/11/swrl#argument1> <today> ;
<http://www.w3.org/2003/11/swrl#argument2> :wet
] ;
rdf:rest [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#IndividualPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :previousDay ;
<http://www.w3.org/2003/11/swrl#argument1> <today> ;
<http://www.w3.org/2003/11/swrl#argument2> <yesterday>
] ;
rdf:rest rdf:nil
]
] ;
<http://www.w3.org/2003/11/swrl#head> [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#IndividualPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :hasFact ;
<http://www.w3.org/2003/11/swrl#argument1> <yesterday> ;
<http://www.w3.org/2003/11/swrl#argument2> :rain
] ;
rdf:rest rdf:nil
]
] .
### Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi
Related
I've been trying to write SWRL rules that automate creation of new entities and their assignment to classes and predicates in a Protege ontology. The code here didn't result in creation of even one individual, neither did the example in the readme work.
For clarity, here is the rule I'm trying to make work:
Person(?person) ^ hasSSN(?person, ?ssn) ^ swrlx:makeOWLThing(?patient, ?person) -> Patient(?patient) ^ hasPID(?patient, ?ssn)
In this ontology:
#prefix : <http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#> .
#prefix owl: <http://www.w3.org/2002/07/owl#> .
#prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
#prefix xml: <http://www.w3.org/XML/1998/namespace> .
#prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
#prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
#base <http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48> .
<http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48> rdf:type owl:Ontology .
#################################################################
# Annotation properties
#################################################################
### http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled
<http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> rdf:type owl:AnnotationProperty .
#################################################################
# Data properties
#################################################################
### http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#hasPID
:hasPID rdf:type owl:DatatypeProperty .
### http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#hasSSN
:hasSSN rdf:type owl:DatatypeProperty .
#################################################################
# Classes
#################################################################
### http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#Patient
:Patient rdf:type owl:Class .
### http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#Person
:Person rdf:type owl:Class .
#################################################################
# Individuals
#################################################################
### http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#person1
:person1 rdf:type owl:NamedIndividual ,
:Person ;
:hasSSN 1001 .
### http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#person2
:person2 rdf:type owl:NamedIndividual ,
:Person ;
:hasSSN 1002 .
### http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#person3
:person3 rdf:type owl:NamedIndividual ,
:Person ;
:hasSSN 1003 .
#################################################################
# Rules
#################################################################
:person rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
:ssn rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
:patient rdf:type <http://www.w3.org/2003/11/swrl#Variable> .
[ <http://swrl.stanford.edu/ontologies/3.3/swrla.owl#isRuleEnabled> "true"^^xsd:boolean ;
rdfs:comment "Patient For Every Person With PID Equal To SSN"^^xsd:string ;
rdfs:label "PatientForEveryPersonWithPIDEqualToSSN"^^xsd:string ;
rdf:type <http://www.w3.org/2003/11/swrl#Imp> ;
<http://www.w3.org/2003/11/swrl#body> [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#ClassAtom> ;
<http://www.w3.org/2003/11/swrl#classPredicate> :Person ;
<http://www.w3.org/2003/11/swrl#argument1> :person
] ;
rdf:rest [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#DatavaluedPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :hasSSN ;
<http://www.w3.org/2003/11/swrl#argument1> :person ;
<http://www.w3.org/2003/11/swrl#argument2> :ssn
] ;
rdf:rest [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#BuiltinAtom> ;
<http://www.w3.org/2003/11/swrl#builtin> <http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl#makeOWLThing> ;
<http://www.w3.org/2003/11/swrl#arguments> ( :patient
:person
)
] ;
rdf:rest rdf:nil
]
]
] ;
<http://www.w3.org/2003/11/swrl#head> [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#ClassAtom> ;
<http://www.w3.org/2003/11/swrl#classPredicate> :Patient ;
<http://www.w3.org/2003/11/swrl#argument1> :patient
] ;
rdf:rest [ rdf:type <http://www.w3.org/2003/11/swrl#AtomList> ;
rdf:first [ rdf:type <http://www.w3.org/2003/11/swrl#DatavaluedPropertyAtom> ;
<http://www.w3.org/2003/11/swrl#propertyPredicate> :hasPID ;
<http://www.w3.org/2003/11/swrl#argument1> :patient ;
<http://www.w3.org/2003/11/swrl#argument2> :ssn
] ;
rdf:rest rdf:nil
]
]
] .
### Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi
Pellet doesn't support SWRLX:
WARNING: Ignoring rule Rule([Person(?person), hasSSN(?person,?ssn), makeOWLThing([?patient, ?person])] => [Patient(?patient), hasPID(?patient,?ssn)]):
No builtin for http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl#makeOWLThing
However, you can use Drools translation. On the SWRLTab, press:
OWL+SWRL -> Drools
Run Drools
Drools -> OWL
This is what was generated (in the Turtle syntax):
#prefix p1: <http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48#> .
#prefix p2: <http://www.semanticweb.org/richard/ontologies/2018/7/untitled-ontology-48##> .
# ...
p2:d5d68a85_03f9_4a69_8c07_9f1a57ffe7aa rdf:type owl:NamedIndividual, p1:Patient ;
p1:hasPID 1003 .
p2:c8c3_3ad6_4c49_b9f6_940f711e8d5f rdf:type owl:NamedIndividual, p1:Patient ;
p1:hasPID 1002 .
p2:c2038_2adb_4d12_b3ee_326cc45ffa2b rdf:type owl:NamedIndividual, p1:Patient ;
p1:hasPID 1001 .
Please note double ## in the generated URIs.
In the following Ontology I'm trying to make Boy the complement of Girl by using OneOf however using Fact++ or Hermit I'm unable to get any instances by querying for Boy (Protege 5.2 DL query), any suggestions?
:Bob rdf:type owl:NamedIndividual ,
:Person .
:Mike rdf:type owl:NamedIndividual ,
owl:Thing .
:Sarah rdf:type owl:NamedIndividual ,
:Girl.
:Person rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Class ;
owl:oneOf ( :Bob
:Mike
:Sarah
)
] .
:Girl rdf:type owl:Class ;
owl:equivalentClass [ rdf:type owl:Class ;
owl:oneOf ( :Sarah
)
] ;
rdfs:subClassOf :Person .
:Boy rdf:type owl:Class ;
owl:equivalentClass [ owl:intersectionOf ( :Person
[ rdf:type owl:Class ;
owl:complementOf :Girl
]
) ;
rdf:type owl:Class
] ;
rdfs:subClassOf :Person ;
owl:disjointWith :Girl .
Adding an axiom to make all individuals as different solves the problem as suggested by Stanislav:
[ rdf:type owl:AllDifferent ;
owl:distinctMembers ( :Bob
:Mike
:Sarah
)
] .
See https://en.wikipedia.org/wiki/Unique_name_assumption
Let's say I'm defining a class Alcohol:
:Alcohol rdf:type owl:Class ;
owl:equivalentClass [
rdf:type owl:Class ;
owl:oneOf ( :Vodka :Champagne :Bourbon :Tequila :Whiskey ) ] .
But I want members to be distinct:
[ rdf:type owl:AllDifferent ;
owl:distinctMembers ( :Bourbon :Vodka :Champagne :Whiskey :Tequila ) ] .
How can I write those two statements without repeating the list?
Thanks.
As mentioned in the comment, use blank node reference:
:Alcohol a owl:Class ;
owl:equivalentClass [ a owl:Class ;
owl:oneOf _:b0 ] .
[ a owl:AllDifferent ;
owl:distinctMembers _:b0 ] .
_:b0 rdf:first :Vodka ;
rdf:rest ( :Champagne :Bourbon :Tequila :Whiskey ) .
I have a sample stored procedure named SPExample .
I want to add a parameter named TestParam to this stored procedure without using this syntax
Alter PROCEDURE SPExample
#TestParamint
AS
BEGIN
...
END
Is there a syntax like: Alter PROCEDURE SPExample Add parameter ... or any other alternative?
Short answer:
NO you can not
Detailed answer:
Alter procedure has 3 different syntax as below:
SQL Server Syntax:
ALTER { PROC | PROCEDURE } [schema_name.] procedure_name [ ; number ]
[ { #parameter [ type_schema_name. ] data_type }
[ VARYING ] [ = default ] [ OUT | OUTPUT ] [READONLY]
] [ ,...n ]
[ WITH <procedure_option> [ ,...n ] ]
[ FOR REPLICATION ]
AS { [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }
[;]
<procedure_option> ::=
[ ENCRYPTION ]
[ RECOMPILE ]
[ EXECUTE AS Clause ]
SQL Server CLR Stored Procedure Syntax:
ALTER { PROC | PROCEDURE } [schema_name.] procedure_name [ ; number ]
[ { #parameter [ type_schema_name. ] data_type }
[ = default ] [ OUT | OUTPUT ] [READONLY]
] [ ,...n ]
[ WITH EXECUTE AS Clause ]
AS { EXTERNAL NAME assembly_name.class_name.method_name }
[;]
Azure SQL Database Syntax:
ALTER { PROC | PROCEDURE } [schema_name.] procedure_name
[ { #parameter [type_schema_name. ] data_type }
[ VARYING ] [= default ] [ [ OUT [ PUT ]
] [,...n ]
[ WITH <procedure_option> [ , ...n ] ]
[ FOR REPLICATION ]
AS
{ <sql_statement> [...n ] }
[;]
<procedure_option> ::=
[ ENCRYPTION ]
[ RECOMPILE ]
[ EXECUTE_AS_Clause ]
<sql_statement> ::=
{ [ BEGIN ] statements [ END ] }
Note that in all 3 syntaxes above, sql_statement is one of the mandatory parts of the syntax. Parts inside [ and ] are optional, Read more about Transact-SQL Syntax Conventions here: https://msdn.microsoft.com/en-us/library/ms177563.aspx
As you see in the above syntaxes there is not any syntax like one you requested.
Read more here: https://msdn.microsoft.com/en-us/library/ms189762.aspx
You cant add parameter with out altering stored proc. A closer option would be to use Default Parameters in case if you dont want to edit your stored procedure when you want to add new Parameter..
this goes something like this..
create proc usp_test
(
#param1 int=4,
#param2 int =null,
#param3 int =null
)
as
Begin
END
Those parameters with null wont be having any impact
I am trying to get some data from land registry API (http://landregistry.data.gov.uk/app/hpi/qonsole) and it uses SPARQL query. I am new to sparql queries and not sure what to pass in my param.query object and how to pass prefixes required.
//myCode
var req = {
method: 'GET',
url: 'http://landregistry.data.gov.uk/landregistry/query',
headers: { 'Content-type' : 'application/x-www-form-urlencoded',
'Accept' : 'application/sparql-results+json' },
params: {
query :"select ?paon ?saon ?street ?town ?county ?postcode ?amount ?date where {?addr lrcommon:postcode "PL6 8RU"} limit 10",
format: "json"
}
};
console.log(req)
// SparQL Query
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/>
#-- 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 in the line - ?address_instance common:postcode "PL6 8RU"^^xsd:string .
SELECT ?paon ?saon ?street ?town ?county ?postcode ?amount ?date
WHERE
{
?transx lrppi:pricePaid ?amount ;
lrppi:transactionDate ?date ;
lrppi:propertyAddress ?addr.
?addr lrcommon:postcode "PL6 8RU"^^xsd:string.
?addr lrcommon:postcode ?postcode.
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
You are half way there. You would use Angular's $http service with the request object you developed (assuming you populate the query string properly). $http service returns a promise, which you can resolve using the shortcut methods available (.success and .error). For these you specify a callback function that is called asynchronously when a response is ready. For example:
$http({
url: 'http://landregistry.data.gov.uk/landregistry/query',
headers: { 'Content-type' : 'application/x-www-form-urlencoded',
'Accept' : 'application/sparql-results+json' },
method: "GET",
params: {
query : "select * where {?s a ?o} limit 10",
format: "json"
}
})
.success(function(data, status, headers, config) {
// callback called asynchronously when the response is available
$scope.results = data.results.bindings;
})
.error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status
});
Here's a working plunker that executes the above query and displays the result.
I think, you can use this answer: How do I POST urlencoded form data with $http in AngularJS? to form your request, and you supply query in the data:
data: {query: "Put your SPARQL Query here"}
SPARQL query is everything below "// SparQL Query" in your listing, just a multiline text in a JavaScript string. (Creating multiline strings in JavaScript for multiline string in JavaScript). For example, if I put it into text file yourquery.txt, I can fetch results with curl:
curl --data-urlencode "query#yourquery.txt" http://landregistry.data.gov.uk/landregistry/query
and it returns nice json:
{
"head": {
"vars": [ "paon" , "saon" , "street" , "town" , "county" , "postcode" , "amount" , "date" ]
} ,
"results": {
"bindings": [
{
"paon": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "58" } ,
"street": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "PATTINSON DRIVE" } ,
"town": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "PLYMOUTH" } ,
"county": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "CITY OF PLYMOUTH" } ,
"postcode": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "PL6 8RU" } ,
"amount": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "56000" } ,
"date": { "datatype": "http://www.w3.org/2001/XMLSchema#date" , "type": "typed-literal" , "value": "1999-11-08" }
} ,
...
}
NB. I am using POST, not GET - this is not essential.
Remark:
?addr lrcommon:postcode "PL6 8RU"^^xsd:string.
?addr lrcommon:postcode ?postcode.
This is not quite good. It's better to use VALUES or BIND:
BIND ("PL6 8RU"^^xsd:string AS ?postcode)
?addr lrcommon:postcode ?postcode.
Because this is what is presumably wanted here. See SPARQL Query language specs for details.
If JavaScript variable's needs to be used in the query, then the value should be escaped and concatenation used:
'BIND ("' + escapedPostcodeVar + '"^^xsd:string AS ?postcode)'
See documentation for details on what and how to escape.
For the reference, working SPARQL query:
var myquery = 'prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n\
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n\
prefix owl: <http://www.w3.org/2002/07/owl#> \n\
prefix xsd: <http://www.w3.org/2001/XMLSchema#> \n\
prefix sr: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/> \n\
prefix lrhpi: <http://landregistry.data.gov.uk/def/hpi/> \n\
prefix lrppi: <http://landregistry.data.gov.uk/def/ppi/> \n\
prefix skos: <http://www.w3.org/2004/02/skos/core#> \n\
prefix lrcommon: <http://landregistry.data.gov.uk/def/common/> \n\
\n\
SELECT ?paon ?saon ?street ?town ?county ?postcode ?amount ?date \n\
WHERE \n\
{ \n\
BIND ("PL6 8RU"^^xsd:string AS ?postcode) \n\
\n\
?addr lrcommon:postcode ?postcode. \n\
\n\
?transx lrppi:pricePaid ?amount ; \n\
lrppi:transactionDate ?date ; \n\
lrppi:propertyAddress ?addr. \n\
\n\
OPTIONAL {?addr lrcommon:county ?county} \n\
OPTIONAL {?addr lrcommon:paon ?paon} \n\
OPTIONAL {?addr lrcommon:saon ?saon} \n\
OPTIONAL {?addr lrcommon:street ?street} \n\
OPTIONAL {?addr lrcommon:town ?town} \n\
} \n\
ORDER BY ?amount \n\
LIMIT 10'
Then in $http:
params: {query: myquery}