Skip to content

Commit 9b5432a

Browse files
committed
[docs] update docs with RDF-based source descriptions
1 parent c883ec1 commit 9b5432a

File tree

3 files changed

+54
-80
lines changed

3 files changed

+54
-80
lines changed

docs/library.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ This query collects data from the Knowledge4COVID-19 KG and DBpedia. See below h
102102
103103
from DeTrusty import get_config, run_query
104104
105-
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.json')
105+
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.ttl')
106106
query = 'https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/Q1.rq'
107107
result = run_query(query, config=config, join_stars_locally=False)
108108
print(result)
@@ -121,7 +121,7 @@ This query collects data from the Knowledge4COVID-19 KG and Wikidata. See below
121121
122122
from DeTrusty import get_config, run_query
123123
124-
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.json')
124+
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.ttl')
125125
query = 'https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/Q2.rq'
126126
result = run_query(query, config=config, join_stars_locally=False)
127127
print(result)
@@ -140,7 +140,7 @@ This query collects data from the Knowledge4COVID-19 KG and DBpedia. See below h
140140
141141
from DeTrusty import get_config, run_query
142142
143-
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.json')
143+
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.ttl')
144144
query = 'https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/Q3.rq'
145145
result = run_query(query, config=config, join_stars_locally=False)
146146
print(result)
@@ -159,7 +159,7 @@ This query collects data from the Knowledge4COVID-19 KG and Wikidata. See below
159159
160160
from DeTrusty import get_config, run_query
161161
162-
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.json')
162+
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.ttl')
163163
query = 'https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/Q4.rq'
164164
result = run_query(query, config=config, join_stars_locally=False)
165165
print(result)
@@ -178,7 +178,7 @@ This query collects data from the Knowledge4COVID-19 KG, DBpedia, and Wikidata.
178178
179179
from DeTrusty import get_config, run_query
180180
181-
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.json')
181+
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/rdfmts.ttl')
182182
query = 'https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/K4COVID/Q5.rq'
183183
result = run_query(query, config=config, join_stars_locally=False)
184184
print(result)
@@ -208,7 +208,7 @@ This query collects data from the World Bank KG and Wikidata. See below how to e
208208
209209
from DeTrusty import get_config, run_query
210210
211-
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/CoyPu/rdfmts.json')
211+
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/CoyPu/rdfmts.ttl')
212212
query = 'https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/CoyPu/Q1.rq'
213213
result = run_query(query, config=config, join_stars_locally=False)
214214
print(result)
@@ -227,7 +227,7 @@ This query collects data from the World Bank KG and Wikidata. See below how to e
227227
228228
from DeTrusty import get_config, run_query
229229
230-
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/CoyPu/rdfmts.json')
230+
config = get_config('https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/CoyPu/rdfmts.ttl')
231231
query = 'https://raw.githubusercontent.com/SDM-TIB/DeTrusty/master/example/CoyPu/Q2.rq'
232232
result = run_query(query, config=config, join_stars_locally=False)
233233
print(result)
@@ -260,14 +260,14 @@ Standard Case
260260
=============
261261

262262
The standard case is to include only public SPARQL endpoints in the federation, collect the source description via SPARQL queries, and consider all classes in the endpoints.
263-
The following code snippet collects the source description of two public endpoints and saves it in the file ``./Config/rdfmts.json``.
263+
The following code snippet collects the source description of two public endpoints and saves it in the file ``./Config/rdfmts.ttl``.
264264

265265
.. code:: python
266266
267267
from DeTrusty.Molecule.MTCreation import create_rdfmts
268268
269269
endpoints = ['http://url_to_endpoint_1', 'https://url_to_endpoint_2:port/sparql']
270-
create_rdfmts(endpoints, './Config/rdfmts.json')
270+
create_rdfmts(endpoints, './Config/rdfmts.ttl')
271271
272272
**Alternatively,** ``None`` can be passed instead of a path.
273273
In that case, ``create_rdfmts`` returns the source description in DeTrusty's internal structure.
@@ -309,7 +309,7 @@ The configuration changes slightly compared to the standard case:
309309
'password': 'YOUR_PASSWORD'
310310
}
311311
}
312-
create_rdfmts(endpoints, './Config/rdfmts.json')
312+
create_rdfmts(endpoints, './Config/rdfmts.ttl')
313313
314314
The keys of ``endpoints`` are the URLs of the SPARQL endpoints.
315315
Each endpoint is represented as a dictionary itself; holding all parameters in the form of (key, value) pairs.
@@ -339,7 +339,7 @@ Of course, this is only feasible for endpoints that were created using RML mappi
339339
]
340340
}
341341
}
342-
create_rdfmts(endpoints, './Config/rdfmts.json')
342+
create_rdfmts(endpoints, './Config/rdfmts.ttl')
343343
344344
The key ``mappings`` holds a list of paths to the mapping files that were used to create the RDF data served by the SPARQL endpoint.
345345

@@ -365,6 +365,6 @@ Starting with version 0.7.0, DeTrusty can restrict the collection of metadata to
365365
]
366366
}
367367
}
368-
create_rdfmts(endpoints, './Config/rdfmts.json')
368+
create_rdfmts(endpoints, './Config/rdfmts.ttl')
369369
370370
The key ``types`` holds a list of all the classes of the endpoint that should be considered for the source description creation process.

docs/service.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Put one URL per line and execute the following command.
7272
7373
docker exec -it DeTrusty bash -c 'create_rdfmts.py -s /DeTrusty/Config/endpoints.txt'
7474
75-
After the new source description file was generated as ``/DeTrusty/Config/rdfmts.json``, you need to restart the ``gunicorn`` workers in order for the changes to take effect.
75+
After the new source description file was generated as ``/DeTrusty/Config/rdfmts.ttl``, you need to restart the ``gunicorn`` workers in order for the changes to take effect.
7676

7777
.. code:: bash
7878

docs/source_description.rst

+41-67
Original file line numberDiff line numberDiff line change
@@ -16,71 +16,45 @@ Since an RDF class can be served by more than just one dataset, this information
1616
For more information and a formal definition, we refer the reader to :cite:p:`Endris2018`.
1717
See below for an example based on FOAF.
1818

19-
.. code:: JSON
19+
.. code:: turtle
2020
21-
[
22-
{
23-
"rootType": "http://xmlns.com/foaf/0.1/Person",
24-
"predicates": [
25-
{
26-
"predicate": "http://xmlns.com/foaf/0.1/interest",
27-
"range": [
28-
"http://xmlns.com/foaf/0.1/Document"
29-
]
30-
},
31-
{
32-
"predicate": "http://xmlns.com/foaf/0.1/knows",
33-
"range": [
34-
"http://xmlns.com/foaf/0.1/Person"
35-
]
36-
},
37-
{
38-
"predicate": "http://xmlns.com/foaf/0.1/name",
39-
"range": []
40-
}
41-
],
42-
"linkedTo": [
43-
"http://xmlns.com/foaf/0.1/Document",
44-
"http://xmlns.com/foaf/0.1/Person"
45-
],
46-
"wrappers": [
47-
{
48-
"url": "http://example.com/sparql",
49-
"predicates": [
50-
"http://xmlns.com/foaf/0.1/interest"
51-
],
52-
"urlparam": ""
53-
},
54-
{
55-
"url": "http://private.example.com/sparql",
56-
"predicates": [
57-
"http://xmlns.com/foaf/0.1/knows",
58-
"http://xmlns.com/foaf/0.1/name"
59-
],
60-
"urlparam": {
61-
"username": "example_user",
62-
"password": "1234"
63-
}
64-
}
65-
]
66-
},
67-
{
68-
"rootType": "http://xmlns.com/foaf/0.1/Document",
69-
"predicates": [
70-
{
71-
"predicate": "http://xmlns.com/foaf/0.1/topic",
72-
"range": []
73-
}
74-
],
75-
"linkedTo": [],
76-
"wrappers": [
77-
{
78-
"url": "http://example.com/sparql",
79-
"predicates": [
80-
"http://xmlns.com/foaf/0.1/topic"
81-
],
82-
"urlparam": ""
83-
}
84-
]
85-
}
86-
]
21+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
22+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
23+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
24+
@prefix semsd: <https://research.tib.eu/semantic-source-description#> .
25+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
26+
27+
foaf:Document a rdfs:Class ;
28+
semsd:hasProperty foaf:topic ;
29+
semsd:hasSource <http://example.com/sparql> .
30+
31+
foaf:Person a rdfs:Class ;
32+
semsd:hasProperty foaf:interest,
33+
foaf:knows,
34+
foaf:name ;
35+
semsd:hasSource <http://example.com/sparql>,
36+
<http://private.example.com/sparql> .
37+
38+
foaf:interest a rdf:Property ;
39+
semsd:hasSource <http://example.com/sparql> ;
40+
semsd:propertyRange [ a semsd:PropertyRange ;
41+
rdfs:domain foaf:Person ;
42+
rdfs:range foaf:Document ] .
43+
44+
foaf:knows a rdf:Property ;
45+
semsd:hasSource <http://private.example.com/sparql> ;
46+
semsd:propertyRange [ a semsd:PropertyRange ;
47+
rdfs:domain foaf:Person ;
48+
rdfs:range foaf:Person ] .
49+
50+
foaf:name a rdf:Property ;
51+
semsd:hasSource <http://private.example.com/sparql> .
52+
53+
foaf:topic a rdf:Property ;
54+
semsd:hasSource <http://example.com/sparql> .
55+
56+
<http://private.example.com/sparql> a semsd:DataSource ;
57+
semsd:hasURL "http://private.example.com/sparql"^^xsd:anyURI .
58+
59+
<http://example.com/sparql> a semsd:DataSource ;
60+
semsd:hasURL "http://example.com/sparql"^^xsd:anyURI .

0 commit comments

Comments
 (0)