comparison demo.py @ 97:354ffd78c0fe

demo of caller code
author drewp@bigasterisk.com
date Mon, 30 May 2022 20:26:16 -0700
parents
children 6443cb265a2f
comparison
equal deleted inserted replaced
96:90d094bcf005 97:354ffd78c0fe
1 import logging
2 from pathlib import Path
3
4 from rdflib import URIRef
5
6 import rdfdb.service
7
8 logging.basicConfig(level=logging.INFO)
9 log = logging.getLogger()
10
11 root = Path('/tmp/rdfdb_demo')
12 root.mkdir(exist_ok=True)
13 (root / "demo.n3").write_text("""
14 @prefix : <http://example.com/myfavprefix> .
15
16 :hello :world :triple .
17 """)
18 (root / "demo2.n3").write_text("""
19 @prefix : <http://example.com/myfavprefix> .
20
21 :hello2 :world :triple .
22 """)
23 app = rdfdb.service.makeApp(
24 dirUriMap={
25 root: URIRef('http://example.com/root/'), #
26 },
27 prefixes={
28 '': URIRef('http://example.com/myfavprefix'),
29 'rdf': URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
30 'rdfs': URIRef('http://www.w3.org/2000/01/rdf-schema#'),
31 },
32 )