Skip to content

Commit

Permalink
#211 Add activity diagrams to SystemOverview.md
Browse files Browse the repository at this point in the history
#371 and #372 document use-cache option
  • Loading branch information
luigi-asprino committed Sep 11, 2024
1 parent b44b491 commit 6420211
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 6 deletions.
15 changes: 15 additions & 0 deletions Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,21 @@ Result
}
```

### use-cache

When set to true, the result of the triplification is cached in memory and used to answer the same query again. (see issue [#371](https://github.com/SPARQL-Anything/sparql.anything/issues/371) and [#372](https://github.com/SPARQL-Anything/sparql.anything/issues/372)).
You can check out whether a query has been evaluated over a cached graph via the `fx:cachedGraph` assertion of the [audit graph](#audit).

#### Valid Values

`true`/`false`

#### Default Value

`false`



<!--
###
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ WHERE {
| [annotate-triples-with-slot-keys](Configuration.md#annotate-triples-with-slot-keys) | It tells SPARQL Anything to annotate slot statements with slot keys (see issue [#378](https://github.com/SPARQL-Anything/sparql.anything/issues/378)) | true/false | false |
| [generate-predicate-labels](Configuration.md#generate-predicate-labels) | It tells SPARQL Anything to create labels for extracted predicates and classes (see issue [#462](https://github.com/SPARQL-Anything/sparql.anything/issues/462)) | true/false | false |
| [audit](Configuration.md#audit) | It tells SPARQL Anything to generate an additional graph containing information for auditing the result of the triplification. The audit graph has the URI &lt;http://sparql.xyz/facade-x/data/audit&gt; | true/false | false |
| [use-cache](Configuration.md#use-cache) | When set to true, the result of the triplification is cached in memory and used to answer the same query again. | true/false | false |

\* If `read-from-std-in` is set to false, it is mandatory to provide either `location`, `content`, or `command`.

Expand Down
20 changes: 19 additions & 1 deletion SystemOverview.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# System overview
# System overview

### Component Diagram

### Activity Diagram

The following flow charts describe the workflow of the FacadeXOpExecutor (see issue [#293](https://github.com/SPARQL-Anything/sparql.anything/issues/293)).


TBD

![Worflow](imgs/workflow1.png)

![Worflow](imgs/workflow2.png)

### Caching system

By the default, the dataset graphs created by extracting data from the source are not cached.
However, by setting the [`use-cache` option](Configuration.md#use-cache) to true the result of the triplification will be stored into an in-memory cache and used for responding the same query twice.
Binary file added imgs/workflow1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/workflow2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public DatasetGraph getDatasetGraph(Triplifier t, Properties p, Op op) throws IO
DatasetGraph dg;
if (t == null) return DatasetGraphFactory.create();

boolean useCache = !PropertyUtils.getBooleanProperty(p, IRIArgument.NO_CACHE);
boolean useCache = !PropertyUtils.getBooleanProperty(p, IRIArgument.USE_CACHE);

if (useCache && FacadeX.executedFacadeXIris.containsKey(getInMemoryCacheKey(p, op))) {
dg = FacadeX.executedFacadeXIris.get(getInMemoryCacheKey(p, op));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.github.sparqlanything.it;

import com.sun.source.tree.AssertTree;
import io.github.sparqlanything.engine.FacadeX;
import org.apache.jena.query.*;
import org.apache.jena.sparql.engine.main.QC;
Expand Down Expand Up @@ -46,11 +45,11 @@ public void testDefaultSetting(){


@Test
public void testNoCache(){
public void testUseCache(){
Dataset ds = DatasetFactory.createGeneral();
QC.setFactory(ARQ.getContext(), FacadeX.ExecutorFactory);

String queryStr = "SELECT ?o { SERVICE <x-sparql-anything:content=abc,txt.split=b,audit=true,strategy=0,no-cache=true> {GRAPH <http://sparql.xyz/facade-x/data/audit> { ?s <http://sparql.xyz/facade-x/ns/cachedGraph> ?o} }}";
String queryStr = "SELECT ?o { SERVICE <x-sparql-anything:content=abc,txt.split=b,audit=true,strategy=0,use-cache=true> {GRAPH <http://sparql.xyz/facade-x/data/audit> { ?s <http://sparql.xyz/facade-x/ns/cachedGraph> ?o} }}";
Query query = QueryFactory.create(queryStr);
// System.out.println(ResultSetFormatter.asText(QueryExecutionFactory.create(query,ds).execSelect()));
ResultSet rs1 = QueryExecutionFactory.create(query,ds).execSelect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class IRIArgument {
public static final IRIArgument NAMESPACE = new IRIArgument("namespace", Triplifier.XYZ_NS);
public static final IRIArgument ROOT = new IRIArgument("root");
public static final IRIArgument BLANK_NODES = new IRIArgument("blank-nodes", "true");
public static final IRIArgument NO_CACHE = new IRIArgument("no-cache", "false");
public static final IRIArgument USE_CACHE = new IRIArgument("use-cache", "false");
public static final IRIArgument TRIPLIFIER = new IRIArgument("triplifier");
public static final IRIArgument CHARSET = new IRIArgument("charset", "UTF-8");
public static final IRIArgument METADATA = new IRIArgument("metadata", "false");
Expand Down

0 comments on commit 6420211

Please sign in to comment.