Skip to content

Commit

Permalink
added voaf vocab
Browse files Browse the repository at this point in the history
  • Loading branch information
situx committed Feb 9, 2024
1 parent a6e354e commit f738193
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions util/export/data/exporter/rdf/voidexporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class VoidExporter:
@staticmethod
def createVoidDataset(dsname,prefixnamespace,deploypath,outpath,licenseuri,modtime,language,stats,subjectstorender,prefixes,classtree=None,propstats=None,nonnscount=None,objectmap=None,startconcept=None):
g=Graph()
g.bind("voaf","http://purl.org/vocommons/voaf#")
g.bind("vext", "http://ldf.fi/void-ext#")
g.bind("vann", "http://purl.org/vocab/vann/")
if dsname==None or dsname=="":
dsname="dataset"
voidds=prefixnamespace+dsname
Expand Down Expand Up @@ -46,6 +49,19 @@ def createVoidDataset(dsname,prefixnamespace,deploypath,outpath,licenseuri,modti
Literal(prefixnamespace,datatype="http://www.w3.org/2001/XMLSchema#string")))
for ns_prefix, namespace in g.namespaces():
g.add((URIRef(voidds), URIRef("http://rdfs.org/ns/void#vocabulary"),URIRef(namespace)))
g.add((URIRef(namespace), URIRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), URIRef("http://purl.org/vocommons/voaf#Vocabulary")))
g.add((URIRef(namespace), URIRef("http://purl.org/vocab/vann/preferredNamespaceUri"),
Literal(namespace,datatype="http://www.w3.org/2001/XMLSchema#anyURI")))
g.add((URIRef(namespace), URIRef("http://purl.org/vocab/vann/preferredNamespacePrefix"),
Literal(ns_prefix,datatype="http://www.w3.org/2001/XMLSchema#string")))
g.add((URIRef(namespace+"_"+str(dsname)+"_occ"), URIRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
URIRef("http://purl.org/vocommons/voaf#DatasetOccurrence")))
g.add((URIRef(namespace+"_"+str(dsname)+"_occ"), URIRef("http://www.w3.org/2000/01/rdf-schema#label"),
Literal("Occurrences of vocabulary "+str(namespace)+" in "+dsname)))
g.add((URIRef(namespace+"_"+str(dsname)+"_occ"), URIRef("http://purl.org/vocommons/voaf#occurrences"),
Literal("0",datatype="http://www.w3.org/2001/XMLSchema#integer")))
g.add((URIRef(namespace), URIRef("http://purl.org/vocommons/voaf#usageInDataset"), URIRef(namespace+"_"+str(dsname)+"_occ")))
g.add((URIRef(namespace+"_"+str(dsname)+"_occ"), URIRef("http://purl.org/vocommons/voaf#inDataset"), URIRef(voidds)))
if str(namespace) in DocConfig.namespaceToTopic:
for entry in DocConfig.namespaceToTopic[str(namespace)]:
g.add((URIRef(voidds), URIRef("http://purl.org/dc/terms/subject"),URIRef(entry["uri"])))
Expand Down

0 comments on commit f738193

Please sign in to comment.