Skip to content

Commit

Permalink
Merge pull request #185 from dschiese/master
Browse files Browse the repository at this point in the history
Added and edited SELECT-Queries for annotation types
  • Loading branch information
anbo-de authored Oct 11, 2023
2 parents 72ff710 + 4d6e169 commit 07a8b23
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT * WHERE {
GRAPH ?graph {
?annotationAnswer
a qa:AnnotationOfAnswerJson ;
oa:hasTarget ?question ;
oa:hasBody ?answer ;
oa:annotatedBy ?service ;
oa:annotatedAt ?time ;
qa:score ?score .
?answer
a qa:AnswerJson ;
rdf:value ?answerJson .
}
}
SELECT *
FROM ?graphURI
WHERE {
?annotationAnswer
a qa:AnnotationOfAnswerJson ;
oa:hasTarget ?hasTarget ;
oa:hasBody ?hasBody ;
oa:annotatedBy ?annotatedBy ;
oa:annotatedAt ?annotatedAt ;
qa:score ?score .
?hasBody
a qa:AnswerJson ;
rdf:value ?value .
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ 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 *
SELECT *
FROM ?graph
WHERE {
GRAPH ?graph {
?newAnnotation rdf:type qa:AnnotationOfAnswerSPARQL .
?newAnnotation oa:hasTarget ?targetQuestion .
?newAnnotation oa:hasBody ?selectQueryThatShouldComputeTheAnswer .
?newAnnotation qa:score ?confidence .
?newAnnotation oa:annotatedAt ?time .
?newAnnotation oa:annotatedBy ?application .
}
?annotationId rdf:type qa:AnnotationOfAnswerSPARQL .
?annotationId oa:hasTarget ?hasTarget ;
oa:hasBody ?hasBody .
OPTIONAL {
?annotationnId qa:score ?score ;
}
?annotationId oa:annotatedAt ?annotatedAt ;
oa:annotatedBy ?annotatedBy .
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PREFIX qa: <http://www.wdaqua.eu/qa#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT *
FROM ?graph
WHERE {
?annotationId a qa:AnnotationOfClass .
?annotationId oa:hasTarget [
a oa:SpecificClass ;
oa:hasSource ?hasSource ;
] .
?annotationId oa:hasBody ?hasBody ;
oa:annotatedBy ?annotatedBy ;
oa:annotatedAt ?annotatedAt .
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>
PREFIX qa: <http://www.wdaqua.eu/qa#>

SELECT *
FROM ?graph
WHERE {
?annotationId rdf:type qa:AnnotationOfInstance .
?annotationId oa:hasTarget [
a oa:SpecificResource;
oa:hasSource ?hasSource;
oa:hasSelector [
a oa:TextPositionSelector;
oa:start ?start;
oa:end ?end
]
].
?annotationId oa:hasBody ?hasBody ;
oa:annotatedBy ?annotatedBy ;
oa:annotatedAt ?annotatedAt .
OPTIONAL {
?annotationId qa:score ?score .
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PREFIX qa: <http://www.wdaqua.eu/qa#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT *
FROM ?graph
WHERE {
?annotationId a qa:AnnotationOfQuestionLanguage .
?annotationId oa:hasTarget ?hasTarget ;
oa:hasBody ?hasBody ;
oa:annotatedBy ?annotatedBy ;
oa:annotatedAt ?annotatedAt .
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
PREFIX qa: <http://www.wdaqua.eu/qa#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>

SELECT ?a ?translation ?time
SELECT *
FROM ?graph
WHERE {
?a a qa:AnnotationOfQuestionTranslation .
?a oa:hasTarget ?targetQuestion .
?a oa:hasBody ?translation .
FILTER (lang(?translation) = ?language).
?annotationId a qa:AnnotationOfQuestionTranslation .
?annotationId oa:hasTarget ?hasTarget ;
oa:hasBody ?hasBody ;
oa:annotatedBy ?annotatedBy ;
oa:annotatedAt ?annotatedAt .
FILTER (lang(?hasBody) = ?language).
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@


PREFIX qa: <http://www.wdaqua.eu/qa#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>

SELECT *
FROM ?graph
WHERE {
?annotationId a qa:AnnotationOfRelation .
?annotationId oa:hasTarget [
a oa:SpecificResource;
oa:hasSource ?hasSource
] .
OPTIONAL {
?annotationId oa:hasTarget [
oa:hasSelector [
a oa:TextPositionSelector ;
oa:start ?start ;
oa:end ?end
]
] .
}
OPTIONAL {
?annotationId qa:score ?score .
}
?annotationId oa:hasBody ?hasBody ;
oa:annotatedBy ?annotatedBy ;
oa:annotatedAt ?annotatedAt .
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>
PREFIX qa: <http://www.wdaqua.eu/qa#>

SELECT *
FROM ?graph
WHERE {
?annotationId rdf:type qa:AnnotationOfSpotInstance.
?annotationId oa:hasTarget [
a oa:SpecificResource;
oa:hasSource ?hasSource;
oa:hasSelector [
a oa:TextPositionSelector;
oa:start ?start;
oa:end ?end .
]
].
?annotationId oa:annotatedAt ?annotatedAt ;
oa:annotatedBy ?annotatedBy .
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PREFIX qa: <http://www.wdaqua.eu/qa#>
PREFIX oa: <http://www.w3.org/ns/openannotation/core/>
PREFIX dbr: <http://dbpedia.org/resource/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT *
FROM ?graph
WHERE {
?annotationId rdf:type qa:AnnotationOfTextAnswerJson .
?annotationId oa:hasTarget ?hasTarget
?annotationId oa:hasBody ?hasBody .
?annotationId oa:annotatedAt ?annotatedAt .
?annotationId oa:annotatedBy ?annotatedBy .
?hasBody rdf:type qa:AnswerJson .
?hasBody rdf:value ?value .
qa:AnswerJson rdfs:subClassOf qa:Answer .
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT *
FROM ?graph
WHERE {
GRAPH ?graph {
?newAnnotation rdf:type qa:AnnotationOfAnswerSPARQL .
?newAnnotation oa:hasTarget ?targetQuestion .
?newAnnotation oa:hasBody ?selectQueryThatShouldComputeTheAnswer .
Expand All @@ -25,6 +25,5 @@ WHERE {

?newAnnotation oa:annotatedBy ?application .
}
}
ORDER BY DESC(?confidence)
LIMIT 1

0 comments on commit 07a8b23

Please sign in to comment.