view demo.py @ 108:a4a060241c73

add a pydeps task. `inv pydeps`
author drewp@bigasterisk.com
date Mon, 30 May 2022 22:44:50 -0700
parents 354ffd78c0fe
children 6443cb265a2f
line wrap: on
line source

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#'),
    },
)