Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
situx committed Jan 20, 2024
1 parent 3c1674c commit 6adfd6d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/sparqlunicorn_ontdoc/docgeneration.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,9 @@ def generateOntDocForNameSpace(self, prefixnamespace,dataformat="HTML"):
uritotreeitem={}
curlicense=self.processLicense()
self.licensehtml=curlicense
numprops=self.getPropertyRelations(self.graph, outpath)
res=self.getPropertyRelations(self.graph, outpath)
numprops=res["preds"]
numobjects=res["objs"]
if self.createColl:
self.graph=self.createCollections(self.graph,prefixnamespace)
if self.logoname!=None and self.logoname!="" and not self.logoname.startswith("http"):
Expand Down Expand Up @@ -384,7 +386,7 @@ def generateOntDocForNameSpace(self, prefixnamespace,dataformat="HTML"):
self.updateProgressBar(subtorencounter, subtorenderlen,"Processing Subject URIs")
self.checkGeoInstanceAssignment(uritotreeitem)
classlist=self.assignGeoClassesToTree(tree)
voidgraph=self.createVoidDataset(self.datasettitle,len(self.graph),numclasses,numinds,numprops,numsubjects,0)
voidgraph=self.createVoidDataset(self.datasettitle,len(self.graph),numclasses,numinds,numprops,numsubjects,numobjects)
self.graph+=voidgraph
if self.generatePagesForNonNS:
labeltouri=self.getSubjectPagesForNonGraphURIs(nonnsmap, self.graph, prefixnamespace, corpusid, outpath, self.license,prefixnamespace,uritotreeitem,labeltouri)
Expand Down Expand Up @@ -502,13 +504,15 @@ def generateOntDocForNameSpace(self, prefixnamespace,dataformat="HTML"):
def getPropertyRelations(self,graph,outpath):
predicates= {}
predicatecounter=0
objects=set()
for pred in graph.predicates(None,None,True):
predicates[pred]={"from":set(),"to":set()}
for tup in graph.subject_objects(pred):
for item in graph.objects(tup[0],URIRef(self.typeproperty),True):
predicates[pred]["from"].add(item)
for item in graph.objects(tup[1], URIRef(self.typeproperty),True):
predicates[pred]["to"].add(item)
objects.add(str(tup[1]))
predicates[pred]["from"]=list(predicates[pred]["from"])
predicates[pred]["to"] = list(predicates[pred]["to"])
predicatecounter+=1
Expand All @@ -517,7 +521,7 @@ def getPropertyRelations(self,graph,outpath):
with open(outpath+"proprelations.js", 'w', encoding='utf-8') as f:
f.write("var proprelations="+json.dumps(predicates))
f.close()
return predicatecounter
return {"preds":predicatecounter,"objs":len(objects)}

def createCollections(self,graph,namespace):
classToInstances={}
Expand Down Expand Up @@ -574,11 +578,7 @@ def createCollections(self,graph,namespace):
return graph


def vocabulariesToDCSubjects(self,vocabs):
print("vocabstosubjects")

def createVoidDataset(self,dsname,numtriples,numclasses,numinds,numpredicates,numsubjects,numobjects):
print("void")
g=Graph()
voidds=self.prefixnamespace+"theds"
g.add((URIRef(voidds),URIRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),URIRef("http://rdfs.org/ns/void#Dataset")))
Expand Down

0 comments on commit 6adfd6d

Please sign in to comment.