diff --git a/README.md b/README.md index 555e5d5..3bdb453 100644 --- a/README.md +++ b/README.md @@ -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 }" + ``` + ## License diff --git a/sparql_query_example.txt b/sparql_query_example.txt index 7400d7f..9a35620 100644 --- a/sparql_query_example.txt +++ b/sparql_query_example.txt @@ -8,7 +8,10 @@ PREFIX vs: PREFIX wot: PREFIX xml: PREFIX xsd: -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 . + } } \ No newline at end of file