Skip to content

Commit

Permalink
added Queries doc to README
Browse files Browse the repository at this point in the history
  • Loading branch information
wiauxb committed Sep 25, 2024
1 parent dc5e97f commit db32951
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,20 @@ Run the different classes:
```
Will output the directives information in the same order Apache would applie them. Those directives are filtered based on the host, location, and optionally the port. If you don't want to filter the directives, you can pass the `-a` or `--all` option.
#### Queries
To run SPARQL queries onto an ontology, you can use the [Querier class](https://github.com/csvl/CWAF_config/blob/develop/cwaf-ontology/src/main/java/be/uclouvain/service/Querier.java) by giving it the path to the Ontology model (in *.owl* or *.ttl*) and the query (a text file) as arguments.
```bash
java -cp cwaf-ontology/target/cwaf-ontology-1.0-SNAPSHOT.jar be.uclouvain.service.Querier full_schema.ttl sparql_query_example.txt
```
To be used in a scripts, the query can also be passed as a string trough the `-q` argument.
```bash
java -cp cwaf-ontology/target/cwaf-ontology-1.0-SNAPSHOT.jar be.uclouvain.service.Querier full_schema.ttl -q "SELECT ?x WHERE {?x <http://visualdataweb.org/ontCWAF/includedIn> <http://visualdataweb.org/ontCWAF/a/file/path>}"
```
## License
Expand Down
7 changes: 5 additions & 2 deletions sparql_query_example.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ PREFIX vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#>
PREFIX wot: <http://xmlns.com/wot/0.1/>
PREFIX xml: <http://www.w3.org/XML/1998/namespace>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?t
SELECT ?s
WHERE {
cwaf:Include_bf4b71bd-d6cd-3ea8-bb96-72e80901a62a rdf:type ?t .
?s rdf:type cwaf:EndLocation .
FILTER NOT EXISTS {
?s cwaf:isEndingLocation ?o .
}
}

0 comments on commit db32951

Please sign in to comment.