Skip to content

Commit

Permalink
labels for owl restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
situx committed Jan 20, 2024
1 parent e3c117a commit 30ffc1b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/sparqlunicorn_ontdoc/docgeneration.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,20 @@ def generateOntDocForNameSpace(self, prefixnamespace,dataformat="HTML"):
if (prefixnamespace in sub and (isinstance(sub,URIRef)) or isinstance(sub,BNode)):
subjectstorender.add(sub)
label=DocUtils.shortenURI(str(sub))
restriction=False
for tup in self.graph.predicate_objects(sub):
if str(tup[0]) in DocConfig.labelproperties:
labeltouri[str(tup[1])] = str(sub)
uritolabel[str(sub)] = {"label":str(tup[1])}
label=str(tup[1])
break
if isinstance(sub,BNode):
for tup in self.graph.objects(None,self.typeproperty):
if tup==URIRef("http://www.w3.org/2002/07/owl#Restriction"):
self.graph.add((sub,URIRef("http://www.w3.org/2000/01/rdf-schema#label"),Literal(label+" [Restriction]",lang="en")))
elif str(tup[1]) == "http://www.w3.org/2002/07/owl#Restriction":
restriction = True
#elif str(tup[1]) == "http://www.w3.org/2000/01/rdf-schema#subClassOf":
# self.graph.add((sub, URIRef("http://www.w3.org/2000/01/rdf-schema#label"),
# Literal(label + " [Restriction]", lang="en")))
if isinstance(sub,BNode) and restriction:
self.graph.add((sub, URIRef("http://www.w3.org/2000/01/rdf-schema#label"),
Literal(label + " [Restriction]", lang="en")))
numsubjects+=1
numinds=len(subjectstorender)
if os.path.exists(outpath + corpusid + '_search.js'):
Expand Down

0 comments on commit 30ffc1b

Please sign in to comment.