Skip to content

Commit ecb0b24

Browse files
committed
merged dev into master
2 parents 0e8983f + 22dbf26 commit ecb0b24

10 files changed

Lines changed: 227 additions & 8 deletions

File tree

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
<<<<<<< HEAD
12
# Use a consistent Node.js version across build and release stages
23
FROM node:23-slim AS builder
4+
=======
5+
FROM docker.io/ubuntu:22.04
6+
>>>>>>> master
37

48
# Install Python for node-gyp (required for sqlite3 build)
59
RUN apt-get update && apt-get install -y python3 build-essential && \

SUMMARY.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* [Metadata](docs/model/metadata/README.md)
1919
* [Group](docs/group.md)
2020
* [Artifact](docs/artifact.md)
21-
* [Version](docs/dataid.md)
21+
* [Version](docs/version.md)
2222
* [Distribution](docs/distribution.md)
2323
* [Collection](docs/collection.md)
2424
* [Content Variants](docs/content-variants.md)
@@ -32,7 +32,8 @@
3232

3333
* [API](docs/usage/api/README.md)
3434
* [Databus Mods](docs/mods.md)
35-
* [Databus Client](docs/databus-client.md)
35+
* [Databus Client](docs/usage/databus_client.md)
36+
* [Integration with CI (Jenkins)](docs/usage/ci.md)
3637
* [Running Your Own Databus Server](docs/running-your-own-databus-server/running-own-server.md)
3738
* [Run with Docker](docs/running-your-own-databus-server/run-with-docker.md)
3839
* [Configuration](docs/running-your-own-databus-server/configuration.md)

devenv/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22
name: databus_devenv
33
services:
44
gstore:
5+
<<<<<<< HEAD
56
restart: unless-stopped
67
image: dbpedia/gstore:dev
78
container_name: databus_devenv_gstore
9+
=======
10+
image: docker.io/dbpedia/gstore:dev
11+
container_name: devenv_gstore
12+
>>>>>>> master
813
environment:
914
STORAGE_USER: "dba"
1015
STORAGE_PASS: "everyoneknows"
@@ -26,9 +31,14 @@ services:
2631
- ./data/index/:/index
2732
- ../search/servlet-config.yml:/resources/config.yml
2833
virtuoso:
34+
<<<<<<< HEAD
2935
restart: unless-stopped
3036
image: "openlink/virtuoso-opensource-7:latest"
3137
container_name: databus_devenv_virtuoso
38+
=======
39+
image: "docker.io/openlink/virtuoso-opensource-7:latest"
40+
container_name: devenv_virtuoso
41+
>>>>>>> master
3242
environment:
3343
DBA_PASSWORD: "everyoneknows"
3444
SPARQL_UPDATE: "true"

docs/databus-client.md

Whitespace-only changes.

docs/guides/data-download-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ version: '3.5'
240240
services:
241241
242242
db:
243-
image: tenforce/virtuoso
243+
image: docker.io/tenforce/virtuoso
244244
ports:
245245
- 8895:8890
246246
volumes:
@@ -254,7 +254,7 @@ services:
254254
# and apply internal path as environment variable.
255255
256256
databus_client:
257-
image: dbpedia/databus-client:latest
257+
image: docker.io/dbpedia/databus-client:latest
258258
environment:
259259
- SOURCE=/databus-client/query.sparql
260260
- ENDPOINT=https://dev.databus.dbpedia.org/sparql

docs/quickstart-examples.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This site describes the minimal required metadata for publishing a dataset (meta
1313

1414
```json
1515
{
16-
"@context": "https://downloads.dbpedia.org/databus/context.jsonld",
16+
"@context": "https://dev.databus.dbpedia.org/res/context.jsonld",
1717
"@graph": [
1818
{
1919
"@type": [
@@ -111,7 +111,7 @@ In the minimal example metadata for the group is missing and the artifact is ini
111111

112112
```javascript
113113
{
114-
"@context": "http://downloads.dbpedia.org/databus/context.jsonld",
114+
"@context": "https://dev.databus.dbpedia.org/res/context.jsonld",
115115
"@id": "https://dev.databus.dbpedia.org/denis/onto_dep_projectx",
116116
"@type": "Group",
117117
"title": "Ontologies used in Project X" ,
@@ -125,7 +125,7 @@ In the minimal example metadata for the group is missing and the artifact is ini
125125

126126
```json
127127
{
128-
"@context": "http://downloads.dbpedia.org/databus/context.jsonld",
128+
"@context": "https://dev.databus.dbpedia.org/res/context.jsonld",
129129
"@id": "https://dev.databus.dbpedia.org/denis/onto_dep_projectx/dbpedia-ontology",
130130
"@type": "Artifact",
131131
"title": "The DBpedia Ontology" ,

docs/running-your-own-databus-server/https-and-proxy-setup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In the `.env` file the `DATABUS_PROXY_SERVER_ENABLE` needs to be set to `true` a
1111
```
1212
services:
1313
databus:
14-
image: "dbpedia/databus"
14+
image: "docker.io/dbpedia/databus"
1515
ports:
1616
...
1717
# - 80:80 # ** uncomment if proxy enabled only** HTTP port of included proxy (caddy) necessary for Auto-HTTPS via ACME and HTTP->HTTPS redirect

docs/usage/ci.md

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Integration with CI (Jenkins)
2+
3+
In this article we briefly describe how to use DBpedia Databus with continuous integration systems like [Jenkins](https://www.jenkins.io) and provide several examples of jenkins pipelines.
4+
5+
## Publishing your data files (datasets) into Databus.
6+
You can use CI tools for publishing metadata of your data into Databus.
7+
Here is an example of jenkins pipeline for that:
8+
9+
```groovy
10+
// databus DataID template for publishing (this is a minimal version)
11+
// here we are publishing only one file
12+
def req(downloadUrl, username, artifact, version, licenseUrl){
13+
return """{
14+
"@context": "https://downloads.dbpedia.org/databus/context.jsonld",
15+
"@graph": [
16+
{
17+
"@type": "Version",
18+
"@id": "https://databus.dbpedia.org/${username}/jenkins/${artifact}/${version}",
19+
"hasVersion": "${version}",
20+
"title": "Test jenkins",
21+
"description": "Test jenkins",
22+
"license": "${licenseUrl}",
23+
"distribution": [
24+
{
25+
"@type": "Part",
26+
"formatExtension": "txt",
27+
"compression": "none",
28+
"downloadURL": "${downloadUrl}"
29+
}
30+
]
31+
}
32+
]
33+
}"""
34+
}
35+
36+
pipeline {
37+
agent any
38+
stages {
39+
stage("Generate data"){
40+
steps{
41+
// we create file for demonstration purpose
42+
script {
43+
sh "echo 'Hello World!' > 'jenkins-test-file-${BUILD_DATE}-${BUILD_NUMBER}.txt'"
44+
}
45+
}
46+
}
47+
// we transfer the file to a nginx www location, the file gets downloadable.
48+
stage('SSH transfer') {
49+
steps([$class: 'BapSshPromotionPublisherPlugin']) {
50+
sshPublisher(
51+
continueOnError: false, failOnError: true,
52+
publishers: [
53+
sshPublisherDesc(
54+
configName: "nginx",
55+
verbose: true,
56+
transfers: [
57+
sshTransfer(sourceFiles: "*.txt", remoteDirectory: "jenkins-test/${BUILD_DATE}")
58+
]
59+
)
60+
]
61+
)
62+
}
63+
}
64+
// we publish the file to databus specifying its download link
65+
stage("Publish to Databus"){
66+
steps{
67+
script{
68+
// USERNAME is your Databus username
69+
withCredentials([usernamePassword(credentialsId: 'DBUS-Kikiriki', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]){
70+
def body = req(
71+
// download uri
72+
"http://test.dbpedia.org/data/jenkins-test/${BUILD_DATE}/jenkins-test-file-${BUILD_DATE}-${BUILD_NUMBER}.txt",
73+
// your Databus username
74+
USERNAME,
75+
"jenkins",
76+
// you specify this as a Databus version
77+
"${BUILD_DATE}-${BUILD_NUMBER}",
78+
"https://dalicc.net/licenselibrary/Apache-2.0"
79+
)
80+
echo """DataID:
81+
${body}"""
82+
83+
84+
def response = httpRequest validResponseCodes: "200",
85+
consoleLogResponseBody: true,
86+
httpMode: 'POST', quiet: true,
87+
requestBody: body,
88+
url: "https://databus.dbpedia.org/api/publish",
89+
customHeaders:[
90+
// here is you Databus Api Key
91+
[name:'X-API-KEY', value: PASSWORD],
92+
[name: "Content-Type", value: "application/ld+json"]
93+
]
94+
95+
echo "Status: ${response.content}"
96+
}
97+
}
98+
}
99+
}
100+
}
101+
}
102+
```
103+
104+
## Downloading data files (datasets) from Databus.
105+
106+
Here is a sample script of how to download the latest version of an artifact from Databus in a jenkins pipeline:
107+
108+
```groovy
109+
// A template for SPARQL query.
110+
// We query 1 file of the latest version of an artifact.
111+
// !!! NOTE that it queries only one file (LIMIT 1), in our case with 1-file artifact it works
112+
def req(artifact){
113+
return """
114+
PREFIX dcat: <http://www.w3.org/ns/dcat#>
115+
PREFIX databus: <https://dataid.dbpedia.org/databus#>
116+
PREFIX dct: <http://purl.org/dc/terms/>
117+
118+
SELECT ?file WHERE
119+
{
120+
GRAPH ?g
121+
{
122+
?dataset databus:artifact <${artifact}> .
123+
?dataset dct:hasVersion ?v .
124+
?dataset dcat:distribution ?distribution .
125+
?distribution databus:file ?file .
126+
}
127+
}
128+
ORDER BY DESC (STR(?v)) LIMIT 1
129+
"""
130+
}
131+
132+
133+
pipeline {
134+
agent any
135+
stages {
136+
137+
stage("latest artifact file"){
138+
steps{
139+
script{
140+
def body = req(
141+
"https://databus.dbpedia.org/kikiriki/jenkins/jenkins"
142+
)
143+
// wrap in a json (x-www-urlencoded also works)
144+
def jsonBody = new groovy.json.JsonBuilder(query: body).toPrettyString()
145+
echo "Query is: \n${body}"
146+
147+
// send post http-request to a databus SPARQL endpoint
148+
def response = httpRequest validResponseCodes: "200",
149+
consoleLogResponseBody: true,
150+
httpMode: 'POST', quiet: true,
151+
requestBody: jsonBody,
152+
url: "https://databus.dbpedia.org/sparql",
153+
customHeaders:[
154+
[name: "Content-Type", value: "application/json"],
155+
[name: "Accept", value: "text/csv"]
156+
]
157+
// if we configure Accept: text/csv the endpoint returns this:
158+
// "file"
159+
// "https://databus.dbpedia.org/kikiriki/jenkins/jenkins/2024-04-09-9/jenkins.txt"
160+
echo "Response: ${response.content}"
161+
// we extract the URI from the response
162+
def fn = response.content.split('\n')[1].replaceAll('"', '').trim()
163+
164+
echo "Download URI: ${fn}"
165+
// we can use the URI to download the file using curl
166+
sh "curl -O ${fn}"
167+
}
168+
}
169+
}
170+
}
171+
172+
}
173+
```

docs/usage/quickstart-examples.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,30 @@ SELECT DISTINCT ?distribution, ?file, ?downloadUrl, ?format, ?byteSize WHERE {
211211
}
212212
```
213213

214+
Retrieving download links for the latest version of an artifact:
215+
```sparql
216+
PREFIX dcat: <http://www.w3.org/ns/dcat#>
217+
PREFIX databus: <https://dataid.dbpedia.org/databus#>
218+
PREFIX dct: <http://purl.org/dc/terms/>
219+
220+
221+
SELECT ?file WHERE
222+
{
223+
{
224+
SELECT ?v WHERE
225+
{
226+
?latestVersion databus:artifact <your artifact ID> .
227+
?latestVersion dct:hasVersion ?v .
228+
}
229+
ORDER BY DESC(STR(?v)) LIMIT 1
230+
}
231+
?dataset dct:hasVersion ?v .
232+
?dataset dcat:distribution ?distribution .
233+
?distribution dcat:downloadURL ?file .
234+
235+
}
236+
```
237+
214238
#### Group/Artifact Metadata Example
215239

216240
In the minimal example metadata for the group is missing and the artifact is initialized with the metadata of the dataset. Both can be explicitly set for better documentation:

server/app/api/swagger.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,16 @@ paths:
8787
"@graph": [
8888
{
8989
"@type": "Version",
90+
<<<<<<< HEAD
9091
"@id": "%DATABUS_RESOURCE_BASE_URL%/[YOUR_ACCOUNT_NAME]/test_group/test_artifact/0.0.1",
9192
"title": "Test Data",
9293
"description": "Test data from the swagger API. This can probably be deleted.",
94+
=======
95+
"@id": "https://dev.databus.dbpedia.org/<your username>/test_group/test_artifact/2022-02-09",
96+
"hasVersion": "2022-02-09",
97+
"title": "test_group test_artifact",
98+
"description": "version of the test_artifact dataset from DBpedia",
99+
>>>>>>> master
93100
"license": "https://dalicc.net/licenselibrary/Apache-2.0",
94101
"distribution": [
95102
{

0 commit comments

Comments
 (0)