You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
889 B
Python
28 lines
889 B
Python
from rdflib import Graph
|
|
from rdflib import RDF, URIRef, Namespace
|
|
XPUB = Namespace("http://xpub.nl/terms/")
|
|
import sys
|
|
|
|
# url = "https://gallery.constantvzw.org/index.php/Maison-des-arts-expo/"
|
|
|
|
# g = Graph()
|
|
# with open("index.rdfa.html") as fin:
|
|
# data = fin.read()
|
|
# g.parse(publicID="index.html", data=data, format="rdfa")
|
|
# # g.parse(file=fin, format="rdfa", override_encoding="utf-8")
|
|
g = Graph()
|
|
g.parse("https://project.xpub.nl/index.rdfa.html", format="rdfa")
|
|
|
|
|
|
context = {
|
|
"@context": {
|
|
"@language": "en",
|
|
"xpub": "http://xpub.nl/terms/",
|
|
"dc": "http://purl.org/dc/terms/",
|
|
"student": { "@id": "xpub:student", "@lang": "en" },
|
|
"project": { "@id": "xpub:project", "@type": "@id" },
|
|
"thesis": { "@id": "xpub:thesis", "@type": "@id" }
|
|
}
|
|
}
|
|
print (g.serialize(format="json-ld", context=context, auto_compact=True))
|