Mercurial > code > home > repos > rdfdb
diff demo.py @ 97:354ffd78c0fe
demo of caller code
author | drewp@bigasterisk.com |
---|---|
date | Mon, 30 May 2022 20:26:16 -0700 |
parents | |
children | 6443cb265a2f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/demo.py Mon May 30 20:26:16 2022 -0700 @@ -0,0 +1,32 @@ +import logging +from pathlib import Path + +from rdflib import URIRef + +import rdfdb.service + +logging.basicConfig(level=logging.INFO) +log = logging.getLogger() + +root = Path('/tmp/rdfdb_demo') +root.mkdir(exist_ok=True) +(root / "demo.n3").write_text(""" +@prefix : <http://example.com/myfavprefix> . + +:hello :world :triple . +""") +(root / "demo2.n3").write_text(""" +@prefix : <http://example.com/myfavprefix> . + +:hello2 :world :triple . +""") +app = rdfdb.service.makeApp( + dirUriMap={ + root: URIRef('http://example.com/root/'), # + }, + prefixes={ + '': URIRef('http://example.com/myfavprefix'), + 'rdf': URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#'), + 'rdfs': URIRef('http://www.w3.org/2000/01/rdf-schema#'), + }, +)