-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #265 from heinpa/extend-sparql-query-methods
Extend methods for creating SPARQL insert queries
- Loading branch information
Showing
8 changed files
with
168 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
qanary_commons/src/main/resources/queries/insert_one_AnnotationOfAnswerDataType.rq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
PREFIX dbr: <http://dbpedia.org/resource/> | ||
PREFIX oa: <http://www.w3.org/ns/openannotation/core/> | ||
PREFIX qa: <http://www.wdaqua.eu/qa#> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
|
||
INSERT { | ||
GRAPH ?graph { | ||
?newTypeAnnotation rdf:type qa:AnnotationOfAnswerDataType . | ||
?newTypeAnnotation oa:hasTarget ?targetQuestion . | ||
?newTypeAnnotation oa:hasBody ?annotationOfAnswerDataType . | ||
?newTypeAnnotation qa:score ?confidence . | ||
?newTypeAnnotation oa:annotatedAt ?time . | ||
?newTypeAnnotation oa:annotatedBy ?application . | ||
|
||
?annotationOfAnswerDataType rdf:type qa:AnswerDataType . | ||
?annotationOfAnswerDataType rdf:value ?answerDataType . | ||
} | ||
} | ||
WHERE { | ||
BIND (IRI(CONCAT("urn:qanary:annotation:answer:type:", STR(RAND()))) AS ?newTypeAnnotation) . | ||
BIND (IRI(CONCAT("urn:qanary:answer:type:", STR(RAND()))) AS ?annotationOfAnswerDataType) . | ||
BIND (now() as ?time) . | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
qanary_commons/src/main/resources/queries/insert_one_AnnotationOfImprovedQuestion.rq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
PREFIX qa: <http://www.wdaqua.eu/qa#> | ||
PREFIX oa: <http://www.w3.org/ns/openannotation/core/> | ||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
INSERT { | ||
GRAPH ?graph { | ||
?annotationImprovedQuestion a qa:AnnotationOfImprovedQuestion ; | ||
oa:hasTarget ?question ; | ||
oa:hasBody ?improvedQuestion ; | ||
oa:annotatedBy ?application ; | ||
oa:annotatedAt ?time ; | ||
qa:score ?score . | ||
|
||
?improvedQuestion a qa:ImprovedQuestion ; | ||
rdf:value ?improvedQuestionText . | ||
} | ||
} | ||
WHERE { | ||
BIND (IRI(str(RAND())) AS ?annotationImprovedQuestion) . | ||
BIND (IRI(str(RAND())) AS ?improvedQuestion) . | ||
BIND (now() AS ?time) . | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
qanary_commons/src/main/resources/queries/select_lowestIndex_AnnotationOfAnswerSPARQL.rq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
PREFIX dbr: <http://dbpedia.org/resource/> | ||
PREFIX oa: <http://www.w3.org/ns/openannotation/core/> | ||
PREFIX qa: <http://www.wdaqua.eu/qa#> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | ||
|
||
SELECT * | ||
FROM ?graph | ||
WHERE { | ||
?newAnnotation rdf:type qa:AnnotationOfAnswerSPARQL . | ||
?newAnnotation oa:hasTarget ?targetQuestion . | ||
?newAnnotation oa:hasBody ?selectQueryThatShouldComputeTheAnswer . | ||
?newAnnotation qa:index ?index . | ||
?newAnnotation oa:annotatedAt ?time . | ||
|
||
{ | ||
SELECT ?time | ||
WHERE { | ||
?newAnnotation rdf:type qa:AnnotationOfAnswerSPARQL . | ||
?newAnnotation oa:annotatedAt ?time . | ||
} | ||
ORDER BY DESC(?time) | ||
LIMIT 2 | ||
} | ||
|
||
?newAnnotation oa:annotatedBy ?application . | ||
} | ||
ORDER BY ASC(?index) | ||
LIMIT 1 |