Skip to content

Commit 2b47daa

Browse files
committed
QuaTor - QuaDer - Queries:
- Quator: Fix version name - QuaDer: Created API configuration - Queries demo
1 parent 7d554a9 commit 2b47daa

File tree

20 files changed

+134
-13
lines changed

20 files changed

+134
-13
lines changed

quads-creator/src/main/java/fr/vcity/RDFConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void insertQuadsToMetadataDataset() {
8181
getStreamRDF(inputFileName, outputFile, graphURI)
8282
.finish();
8383

84-
getMetadataStreamRDF(inputFileName, graphURI)
84+
getMetadataStreamRDF(inputFile, graphURI)
8585
.finish();
8686
}
8787

quads-loader/src/main/java/fr/vcity/converg/controllers/QuadImportController.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import io.swagger.v3.oas.annotations.responses.ApiResponses;
1010
import io.swagger.v3.oas.annotations.tags.Tag;
1111
import org.apache.jena.riot.RiotException;
12+
import org.springframework.beans.factory.annotation.Value;
1213
import org.springframework.http.ResponseEntity;
1314
import org.springframework.web.bind.annotation.*;
1415
import org.springframework.web.multipart.MultipartFile;
@@ -18,6 +19,10 @@
1819
@Tag(name = "Import API")
1920
@RequestMapping("/import")
2021
public class QuadImportController {
22+
23+
@Value("${quad.importer.enabled}")
24+
boolean quadImporterEnabled;
25+
2126
QuadImportService quadImportService;
2227

2328
public QuadImportController(QuadImportService quadImportService) {
@@ -43,8 +48,12 @@ ResponseEntity<Integer> importModel(
4348
@RequestParam("file") MultipartFile file
4449
) {
4550
try {
46-
Integer indexVersion = quadImportService.importModel(file);
47-
return ResponseEntity.ok(indexVersion);
51+
if (quadImporterEnabled) {
52+
Integer indexVersion = quadImportService.importModel(file);
53+
return ResponseEntity.ok(indexVersion);
54+
} else {
55+
return ResponseEntity.ok(null);
56+
}
4857
} catch (RiotException e) {
4958
return ResponseEntity
5059
.badRequest()
@@ -70,7 +79,10 @@ ResponseEntity<Void> importMetadata(
7079
@RequestParam("file") MultipartFile file
7180
) {
7281
try {
73-
quadImportService.importMetadata(file);
82+
if (quadImporterEnabled) {
83+
quadImportService.importMetadata(file);
84+
}
85+
7486
return ResponseEntity.ok().build();
7587
} catch (RiotException e) {
7688
return ResponseEntity
@@ -88,6 +100,8 @@ ResponseEntity<Void> importMetadata(
88100
})
89101
@DeleteMapping(value = {"/metadata"})
90102
void removeMetadata() {
91-
quadImportService.removeMetadata();
103+
if (quadImporterEnabled) {
104+
quadImportService.removeMetadata();
105+
}
92106
}
93107
}

workflows/queries/blazegraph/blazegraph-0.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ SELECT ?g ?s ?p ?o WHERE {
44
?s ?p ?o .
55
}
66
FILTER(?g != <https://github.com/VCityTeam/ConVer-G/Named-Graph#Metadata>)
7-
}
7+
} LIMIT 1000

workflows/queries/blazegraph/blazegraph-1.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ SELECT ?s ?p ?o WHERE {
33
GRAPH <https://github.com/VCityTeam/ConVer-G/Named-Graph#Metadata> {
44
?s ?p ?o .
55
}
6-
}
6+
} LIMIT 1000
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Find the number of rating of reviews in each graph
2+
PREFIX bsbm: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/>
3+
PREFIX vers: <https://github.com/VCityTeam/ConVer-G/Version#>
4+
5+
SELECT ?graph (COUNT(?rating) as ?countrating) WHERE {
6+
GRAPH ?vg {
7+
?s a bsbm:Review ;
8+
bsbm:rating3 ?rating .
9+
}
10+
11+
GRAPH <https://github.com/VCityTeam/ConVer-G/Named-Graph#Metadata> {
12+
?vg vers:is-version-of ?graph .
13+
}
14+
} GROUP BY ?graph
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Find the number of rating of reviews in each graph
2+
PREFIX bsbm: <http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/vocabulary/>
3+
PREFIX vers: <https://github.com/VCityTeam/ConVer-G/Version#>
4+
5+
SELECT ?version (AVG(?rating) as ?avgrating) WHERE {
6+
GRAPH ?vg {
7+
?s a bsbm:Review ;
8+
bsbm:rating3 ?rating .
9+
}
10+
11+
GRAPH <https://github.com/VCityTeam/ConVer-G/Named-Graph#Metadata> {
12+
?vg vers:is-in-version ?version .
13+
}
14+
} GROUP BY ?version

workflows/queries/blazegraph/blazegraph-5.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Query the graph store for all quads with a given subject and a join on the predicate and subject (object might be equal to object2)
2-
SELECT ?graph ?subject ?predicate ?object ?object2 WHERE {
2+
SELECT ?graph ?predicate ?object ?object2 WHERE {
33
GRAPH ?graph {
44
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature287> ?predicate ?object ,
55
?object2 .

workflows/queries/blazegraph/blazegraph-6.rq

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Query the graph store for all quads in a specific versioned graph with a given subject and a join on the subject (predicate might be equal to predicate2 and object might be equal to object2)
22
SELECT ?p ?o WHERE {
3-
GRAPH <https://github.com/VCityTeam/ConVer-G/Versioned-Named-Graph#a156e4f5c5cb3dda5b72fb64c4264de925a10fbdefa8ae5b7066e69027edbd48> {
3+
GRAPH <https://github.com/VCityTeam/ConVer-G/Versioned-Named-Graph#f9f46affceacefb7f493e84dd18206309777c31cdfa09d0b7e945961eac004b9> {
44
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature287> ?p ?o ;
55
?p2 ?o2 .
66
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Give the graph name (metadata) of the versioned graph containing the product feature 287
2+
SELECT ?graph ?p ?o WHERE {
3+
GRAPH ?vg {
4+
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature287> ?p ?o ;
5+
?p2 ?o2 .
6+
}
7+
8+
GRAPH <https://github.com/VCityTeam/ConVer-G/Named-Graph#Metadata> {
9+
?vg <https://github.com/VCityTeam/ConVer-G/Version#is-version-of> ?graph .
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Give the graph name (metadata) of the versioned graph containing the product feature 287 and its type
2+
SELECT ?version ?p1 ?o1 ?type WHERE {
3+
GRAPH ?vg {
4+
<http://www4.wiwiss.fu-berlin.de/bizer/bsbm/v01/instances/ProductFeature287> ?p1 ?o1 ;
5+
a ?type .
6+
}
7+
8+
GRAPH <https://github.com/VCityTeam/ConVer-G/Named-Graph#Metadata> {
9+
?vg <https://github.com/VCityTeam/ConVer-G/Version#is-in-version> ?version .
10+
}
11+
}

0 commit comments

Comments
 (0)