Skip to content

Commit ea27216

Browse files
Eisenbahnplattegitbook-bot
authored andcommitted
GITBOOK-23: change request with no subject merged in GitBook
1 parent b6d6052 commit ea27216

File tree

10 files changed

+164
-153
lines changed

10 files changed

+164
-153
lines changed

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ First, we need to select the Databus, where we want to get our data from. We tak
4343

4444
To select data from a DBpedia Databus, you can perform queries. Databus provides two mechanisms for this, which are described in detail [here](https://dbpedia.gitbook.io/databus/#querying-metainformation). 
4545

46-
We use the following query as selection for this example:
46+
We use the following query as selection for this example and write it to the file `test.sparql`:
4747

4848
```
49-
PREFIX dcat: <http://www.w3.org/ns/dcat#>
49+
echo "PREFIX dcat: <http://www.w3.org/ns/dcat#>
5050
PREFIX databus: <https://dataid.dbpedia.org/databus#>
5151
5252
SELECT ?file WHERE
@@ -58,7 +58,7 @@ SELECT ?file WHERE
5858
?dataset dcat:distribution ?distribution .
5959
?distribution databus:file ?file .
6060
}
61-
}
61+
}" > test.sparql
6262
```
6363

6464
### Download and convert selected data
@@ -67,20 +67,8 @@ In order to download the data we need to pass the query as the _`-s`_ argument.
6767

6868
```
6969
java -jar target/databus-client-v2.1-beta.jar \
70-
-s "PREFIX dcat: <http://www.w3.org/ns/dcat#>
71-
PREFIX databus: <https://dataid.dbpedia.org/databus#>
72-
73-
SELECT ?file WHERE
74-
{
75-
GRAPH ?g
76-
{
77-
?dataset databus:artifact <https://dev.databus.dbpedia.org/tester/testgroup/testartifact> .
78-
{ ?distribution <http://purl.org/dc/terms/hasVersion> '2023-06-23' . }
79-
?dataset dcat:distribution ?distribution .
80-
?distribution databus:file ?file .
81-
}
82-
}" \
83-
-e "https://dev.databus.dbpedia.org/sparql" \
70+
-s test.sparql \
71+
-e https://dev.databus.dbpedia.org/sparql \
8472
-f nt
8573
```
8674

SUMMARY.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
* [Overview](README.md)
44
* [Features](docs/overview/features.md)
55
* [Usage](docs/usage/README.md)
6-
* [CLI](docs/usage/cli.md)
76
* [JAR](docs/usage/jar.md)
8-
* [Docker](docs/usage/docker2.md)
7+
* [CLI](docs/usage/cli.md)
8+
* [Docker](usage/docker.md)
99
* [Scala/Java API](docs/usage/api.md)
1010
* [Examples](docs/examples/README.md)
11-
* [Test](docs/examples/exampleCLI.md)
12-
*
1311
* [Loading geocoordinates from Wikipedia into Virtuoso (Docker)](docs/examples/exampleDocker.md)
14-
* [Docker Example 2](docs/examples/exampleDocker2.md)

docs/examples/exampleCLI.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

docs/examples/exampleDocker2.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

docs/usage/README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
# Usage
22

3-
## Download Queries
3+
## Databus Client Parameters
44

5-
Various datasets are registered on the DBpedia Databus in the form of files. A download query specifies an exact selection of these records of the [DBpedia Databus](https://databus.dbpedia.org/) to be processed by the Databus Client. Therefore, the download query is one of, if not the most important parameter of the client.
5+
<table><thead><tr><th width="322.3333333333333">Option</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td>-s, --source</td><td>Set the source you want to convert. A source can either be a <code>[file/directory]</code> to convert already existing files, or a <code>[query file/query string/collection URI]</code> to convert queried files. Notice that query files must have <code>.sparql</code>/<code>.query</code> as extension to be recognized.</td><td></td></tr><tr><td>-e, --endpoint</td><td>Set the sparql endpoint, where the query should be fired to. If you use a collection you don't need this parameter, because its detected automatically. Otherwise its mandatory.</td><td></td></tr><tr><td>-t, --target</td><td>Set the target directory for converted files</td><td><code>./files/</code></td></tr><tr><td>-c, --compression</td><td>Set the compression format of the output file</td><td><code>same</code></td></tr><tr><td>-f, --format</td><td>Set the file format of the output file</td><td><code>same</code></td></tr><tr><td>-m, --mapping</td><td>Set the mapping file for format-conversion to different format equivalence class</td><td></td></tr><tr><td>-d, --delimiter</td><td>Set the delimiter (only necessary for some formats)</td><td>,</td></tr><tr><td>-q, --quotation</td><td>Set the quotation (only necessary for some formats)</td><td>"</td></tr><tr><td>--createMapping</td><td>Do you want to create mapping files for mapped sources?</td><td>false</td></tr><tr><td>-g, --graphURI</td><td>Set the graph uri for mapping from rdf triples to rdf quads</td><td></td></tr><tr><td>-b, --baseURI</td><td>set the base URI to resolve relative URIs</td><td></td></tr><tr><td>-o, --overwrite</td><td>true -> overwrite files in cache, false -> use cache</td><td><code>true</code></td></tr><tr><td>--clear</td><td>true -> clear Cache</td><td><code>false</code></td></tr><tr><td>--help</td><td>Show this message</td><td></td></tr></tbody></table>
6+
7+
## Queries
8+
9+
Various datasets are registered on the DBpedia Databus in the form of files. A query specifies an exact selection of these records of the [DBpedia Databus](https://databus.dbpedia.org/) to be processed by the Databus Client. Therefore, the query is one of, if not the most important parameter of the client.
610

711
### Possible queries
812

9-
You can pass any query that selects the object of the predicate `dcat:downloadURL`, the name of the variable does not matter. The query should look like.\
10-
`SELECT ?o WHERE { ?s dcat:downloadURL ?o}`
13+
You can pass any query that selects the object of the predicate `databus:file`, the name of the variable does not matter. The query should look like.\
14+
`SELECT ?o WHERE { ?s databus:file ?o}`
1115

1216
### How to pass queries
1317

1418
There are three different ways to pass a query to the Databus Client:
1519

1620
1. Pass the query string directly as a parameter.
21+
* **Note:** this option does not work for [cli.md](cli.md "mention")
1722
2. Save the query in a file and pass the file path as a parameter.
1823
* The file extension of the query file must be `.sparql` or `.query`.
1924
3. Collection URIs are also supported. The client receives the associated query itself.
20-
* e.g. `https://databus.dbpedia.org/jfrey/collections/id-management_links`
25+
* e.g. [https://dev.databus.dbpedia.org/testuser/collections/testcollection/](https://dev.databus.dbpedia.org/testuser/collections/testcollection/)

docs/usage/api.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
1-
# Quickstart - API
1+
# Scala/Java API
22

3-
The Databus Client also offers an [API](https://github.com/dbpedia/databus-client/blob/master/src/main/scala/org/dbpedia/databus/client/api/DatabusClient.scala) for easy integration into your project.
3+
The Databus Client also offers an [API](../../src/main/scala/org/dbpedia/databus/client/api/DatabusClient.scala) for easy integration into your project. Currently i\
4+
Currently there is no entry on mvn central for the Databus Client. But you can include the jar of the latest release in your project.
5+
6+
## Installation
7+
8+
#### download jar file
9+
10+
* Download the `databus-client.jar` of the latest [Databus Client release](https://github.com/dbpedia/databus-client/releases/latest)
11+
* Move the file to `${project.basedir}/src/main/resources/databus-client.jar`
12+
13+
#### include dependency (example for maven)
14+
15+
```
16+
<dependency>
17+
<groupId>com.sample</groupId>
18+
<artifactId>sample</artifactId>
19+
<version>1.0</version>
20+
<scope>system</scope>
21+
<systemPath>${project.basedir}/src/main/resources/databus-client.jar</systemPath>
22+
</dependency>
23+
```
24+
25+
### Execution
26+
27+
After you included the DatabusClient dependency, you can use it in your application.
428

5-
## Example
629
```
730
DatabusClient
831
.source("./src/query/query1")
@@ -12,6 +35,6 @@ DatabusClient
1235
.execute()
1336
```
1437

15-
## Sample project
38+
## Sample project (outdated)
1639

17-
We have also created a [sample project](https://github.com/dbpedia/databus-client/tree/master/examples/sample_project) that shows how the Databus Client can be integrated into a project.
40+
We have also created a [sample project](https://github.com/dbpedia/databus-client/tree/master/examples/sample\_project) that shows how the Databus Client can be integrated into a project.

docs/usage/cli.md

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## DBpedia Databus Client
44

5+
### Requirements
6+
7+
* **Java:** `JDK 8` or `JDK 11`
8+
* Maven: `^3.6`
9+
510
### Installation
611

712
```
@@ -12,8 +17,35 @@ mvn clean install
1217

1318
### Execution example
1419

20+
#### Select Query
21+
22+
First we need to specify, the data we want to download.
23+
24+
**Note:** _It is best practice to write a query to a file and pass this file as source, instead of passing the query directly as a string._
25+
26+
<pre><code><strong>echo "PREFIX dcat: &#x3C;http://www.w3.org/ns/dcat#>
27+
</strong>PREFIX databus: &#x3C;https://dataid.dbpedia.org/databus#>
28+
29+
SELECT ?file WHERE
30+
{
31+
GRAPH ?g
32+
{
33+
?dataset databus:artifact &#x3C;https://dev.databus.dbpedia.org/tester/testgroup/testartifact> .
34+
{ ?distribution &#x3C;http://purl.org/dc/terms/hasVersion> '2023-06-23' . }
35+
?dataset dcat:distribution ?distribution .
36+
?distribution databus:file ?file .
37+
}
38+
}" > query.sparql
39+
</code></pre>
40+
41+
#### Execute Client
42+
1543
```
16-
bin/DatabusClient -s ./src/resources/queries/example.sparql -f jsonld -c gz
44+
bin/DatabusClient \
45+
-s query.sparql \
46+
-e https://dev.databus.dbpedia.org/sparql
47+
-f jsonld \
48+
-c gz
1749
```
1850

1951
You will find more information if you set the flag`-h` or in [CLI usage](cli.md).
@@ -27,32 +59,14 @@ The converter and downloader of the Databus Client can be used separately.
2759
Since the parameters `compression` and `format` both have the default value `equal`, the Databus Client is a pure downloader if you do not pass any arguments for compression and format.
2860

2961
```
30-
bin/DatabusClient -s ./src/resources/queries/example.sparql
62+
bin/DatabusClient -s query.sparql
3163
```
3264

3365
### Compression and format converter
3466

3567
If you select already existing files as the `source`, the client does not use the download module and behaves like a pure converter.
3668

3769
```
38-
bin/DatabusClient -s ./src/test/resources/databus-client-testbed/format-testbed/2019.08.30/ -f ttl -c gz
70+
bin/DatabusClient -s query.sparql -f ttl -c gz
3971
```
4072

41-
## CLI options
42-
43-
| Option | Description | Default |
44-
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
45-
| -s, --source | Set the source you want to convert. A source can either be a `[file/directory]` to convert already existing files, or a `[query file/query string/collection URI]` to convert queried files. Notice that query files must have `.sparql`/`.query` as extension to be recognized. | |
46-
| -t, --target | Set the target directory for converted files | `./files/` |
47-
| -c, --compression | Set the compression format of the output file | `same` |
48-
| -f, --format | Set the file format of the output file | `same` |
49-
| -m, --mapping | Set the mapping file for format-conversion to different format equivalence class | |
50-
| -d, --delimiter | Set the delimiter (only necessary for some formats) | , |
51-
| -q, --quotation | Set the quotation (only necessary for some formats) | " |
52-
| --createMapping | Do you want to create mapping files for mapped sources? | false |
53-
| -g, --graphURI | Set the graph uri for mapping from rdf triples to rdf quads | |
54-
| -b, --baseURI | set the base URI to resolve relative URIs | |
55-
| -o, --overwrite | true -> overwrite files in cache, false -> use cache | `true` |
56-
| --clear | true -> clear Cache | `false` |
57-
| --help | Show this message | |
58-

docs/usage/docker2.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/usage/jar.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,44 @@
11
# JAR
22

3-
Instead of cloning the whole repository, you can only download the`databus-client.jar` of the latest [Databus Client release](https://github.com/dbpedia/databus-client/releases/latest).&#x20;
3+
Instead of cloning the whole repository, you can only download the `databus-client.jar` of the latest [Databus Client release](https://github.com/dbpedia/databus-client/releases/latest).&#x20;
44

5-
The parameter options are similar to these ones shown in [#cli-options](cli.md#cli-options "mention")
5+
The parameter options are shown in [#databus-client-parameters](./#databus-client-parameters "mention")
66

7-
### Execution example
7+
### Requirements
8+
9+
* **Java:** `JDK 11`
10+
11+
## Execution example
12+
13+
### Select Data
14+
15+
First we need to specify, the data we want to download.
16+
17+
**Note:** _It is best practice to write a query to a file and pass this file as source, instead of passing the query directly as a string._
818

919
```
10-
java -jar databus-client-1.0-SNAPSHOT.jar -s "https://databus.dbpedia.org/rogargon/collections/browsable_core"
20+
echo "PREFIX dcat: <http://www.w3.org/ns/dcat#>
21+
PREFIX databus: <https://dataid.dbpedia.org/databus#>
22+
23+
SELECT ?file WHERE
24+
{
25+
GRAPH ?g
26+
{
27+
?dataset databus:artifact <https://dev.databus.dbpedia.org/tester/testgroup/testartifact> .
28+
{ ?distribution <http://purl.org/dc/terms/hasVersion> '2023-06-23' . }
29+
?dataset dcat:distribution ?distribution .
30+
?distribution databus:file ?file .
31+
}
32+
}" > query.sparql
1133
```
1234

35+
### Download and Convert Data
36+
37+
Then we can download the selected data, and convert it to ntriple files.
38+
39+
```
40+
java -jar databus-client.jar \
41+
-s "query.sparql" \
42+
-e "https://dev.databus.dbpedia.org/sparql" \
43+
-f nt
44+
```

0 commit comments

Comments
 (0)