Skip to content

Commit

Permalink
Merge branch 'master' into snyk-upgrade-eeaf18052c6af32ced9fa5a85d26205c
Browse files Browse the repository at this point in the history
# Conflicts:
#	qanary_pipeline-template/pom.xml
  • Loading branch information
Calvin committed Oct 11, 2023
2 parents a1b9931 + 07a8b23 commit 5340060
Show file tree
Hide file tree
Showing 24 changed files with 480 additions and 284 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
STARDOG_PASSWORD: ${{ secrets.STARDOG_PASSWORD }}
steps:
- name: Docker Login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build the Docker images and Push to Dockerhub
run: bash -c ./service_config/build_images.sh
- name: Init update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
423 changes: 246 additions & 177 deletions qanary-configuration-frontend/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions qanary-configuration-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.3",
"private": true,
"dependencies": {
"@babel/core": "7.20.12",
"@babel/core": "7.21.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^7.2.1",
Expand Down Expand Up @@ -34,7 +34,7 @@
]
},
"devDependencies": {
"@babel/core": "7.20.12",
"@babel/core": "7.21.0",
"axios": "^0.21.2"
}
}
6 changes: 3 additions & 3 deletions qanary_commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
<modelVersion>4.0.0</modelVersion>
<groupId>eu.wdaqua.qanary</groupId>
<artifactId>qa.commons</artifactId>
<version>3.8.2</version>
<version>3.8.5</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath /> <!-- lookup parent from repository -->
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<java.version>11</java.version>
<spring-boot-admin.version>2.7.10</spring-boot-admin.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<jena.version>4.7.0</jena.version>
<jena.version>4.9.0</jena.version>
<stardog.version>[8.0.0,9.0.0)</stardog.version>
<mockito.version>4.4.0</mockito.version><!-- last working version -->
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,14 +585,16 @@ public List<SparqlAnnotation> getSparqlResults() throws SparqlQueryFailed {
+ " } \n" //
+ " OPTIONAL { ?a qa:score ?confidence . } \n" //
+ " OPTIONAL { ?a qa:overKnowledgeGraph ?kb . } \n" //
+ " ?a oa:annotatedAt ?time1 . \n" //
+ " { \n" //
+ " SELECT ?time1 { \n" //
+ " ?a a qa:AnnotationOfAnswerSPARQL . \n" //
+ " ?a oa:annotatedAt ?time1 . \n" //
+ " } \n" //
+ " ORDER BY DESC(?time1) \n" //
+ " LIMIT 1 \n" //
+ " OPTIONAL { \n" //
+ " ?a oa:annotatedAt ?time1 . \n" //
+ " { \n" //
+ " SELECT ?time1 { \n" //
+ " ?a a qa:AnnotationOfAnswerSPARQL . \n" //
+ " ?a oa:annotatedAt ?time1 . \n" //
+ " } \n" //
+ " ORDER BY DESC(?time1) \n" //
+ " LIMIT 1 \n" //
+ " } \n" //
+ " } \n" //
+ "} \n" //
+ "ORDER BY DESC(?score) \n";
Expand Down Expand Up @@ -622,11 +624,11 @@ public class SparqlAnnotation {
}

public String getSparqlResult() throws SparqlQueryFailed {
// added try and catch to prevent indexOutOfBoundsException, returns empty String if no Query was found
// added try and catch to prevent indexOutOfBoundsException and NullPointerException, returns empty String if no Query was found
String sparqlResult = "";
try {
sparqlResult = this.getSparqlResults().get(0).query;
} catch (IndexOutOfBoundsException e) {
} catch (IndexOutOfBoundsException | NullPointerException e) {
logger.warn("No SPARQL Query found, index out of bounds");
}
return sparqlResult;
Expand All @@ -643,21 +645,23 @@ public String getJsonResult() throws SparqlQueryFailed {
+ " ?a a qa:AnnotationOfAnswerJson . " //
+ " ?a oa:hasBody ?answer . " //
+ " ?answer rdf:value ?json . " //
// + " ?a a qa:AnnotationOfAnswerJSON . " //
// + " ?a oa:hasBody ?json " //
// TODO: this should be body of AnswerJson with rdf:value answer
+ "}";
logger.debug("getJsonResult: SELECT using:\n{}", sparql);
ResultSet resultset = this.getQanaryTripleStoreConnector().select(sparql);

// the default value has to be null to distinguish missing values from empty values
// OLD: the default value has to be null to distinguish missing values from empty values
// NEW: returning null would result in "null" being part of the response JSON,
// return an empty string instead.
// This way, a distinction is still possible:
// missing values: ""
// empty values: []
String sparqlAnnotation = null;
while (resultset.hasNext()) {
sparqlAnnotation = resultset.next().get("json").asLiteral().toString();
}

if (sparqlAnnotation == null) {
return sparqlAnnotation;
return "";
} else {
return sparqlAnnotation.replace("\\\"", "\"");
}
Expand Down
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
2 changes: 1 addition & 1 deletion qanary_component-template/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</parent>
<properties>
<java.version>11</java.version>
<spring-boot-admin.version>2.6.7</spring-boot-admin.version>
<spring-boot-admin.version>2.7.10</spring-boot-admin.version>
</properties>

<dependencies>
Expand Down
Loading

0 comments on commit 5340060

Please sign in to comment.