From f73819350002b201d3d6537c865b688f76d33390 Mon Sep 17 00:00:00 2001 From: Timo Date: Sat, 10 Feb 2024 00:32:13 +0100 Subject: [PATCH] added voaf vocab --- util/export/data/exporter/rdf/voidexporter.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/util/export/data/exporter/rdf/voidexporter.py b/util/export/data/exporter/rdf/voidexporter.py index 7371d8da..f02650dc 100644 --- a/util/export/data/exporter/rdf/voidexporter.py +++ b/util/export/data/exporter/rdf/voidexporter.py @@ -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 @@ -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"])))