@@ -2197,7 +2197,7 @@ def resolveTemplate(templatename):
2197
2197
2198
2198
class OntDocGeneration :
2199
2199
2200
- def __init__ (self , prefixes ,prefixnamespace ,prefixnsshort ,license ,labellang ,outpath ,graph ,createIndexPages ,createColl ,metadatatable ,generatePagesForNonNS ,createVOWL ,ogcapifeatures ,iiif ,ckan = True ,localOptimized = False ,imagemetadata = None ,startconcept = None ,deploypath = "" ,logoname = "" ,templatename = "default" ,offlinecompat = False ,exports = ["json" ,"ttl" ],datasettitle = "" ,publisher = "" ,publishingorg = "" ):
2200
+ def __init__ (self , prefixes ,prefixnamespace ,prefixnsshort ,license ,labellang ,outpath ,graph ,createIndexPages ,createColl ,metadatatable ,generatePagesForNonNS ,createVOWL ,ogcapifeatures ,iiif ,ckan = True ,solidexport = True , localOptimized = False ,imagemetadata = None ,startconcept = None ,deploypath = "" ,logoname = "" ,templatename = "default" ,offlinecompat = False ,exports = ["json" ,"ttl" ],datasettitle = "" ,publisher = "" ,publishingorg = "" ):
2201
2201
self .prefixes = prefixes
2202
2202
self .prefixnamespace = prefixnamespace
2203
2203
self .namespaceshort = prefixnsshort .replace ("/" ,"" )
@@ -2206,6 +2206,7 @@ def __init__(self, prefixes,prefixnamespace,prefixnsshort,license,labellang,outp
2206
2206
self .datasettitle = datasettitle
2207
2207
self .logoname = logoname
2208
2208
self .ckan = ckan
2209
+ self .solidexport = solidexport
2209
2210
self .publisher = publisher
2210
2211
self .publishingorg = publishingorg
2211
2212
self .startconcept = startconcept
@@ -2489,7 +2490,8 @@ def generateOntDocForNameSpace(self, prefixnamespace,dataformat="HTML"):
2489
2490
with open (outpath + corpusid + '_search.js' , 'w' , encoding = 'utf-8' ) as f :
2490
2491
f .write ("var search=" + json .dumps (labeltouri , indent = 2 , sort_keys = True ))
2491
2492
f .close ()
2492
- IIIFAPIExporter .generateIIIFAnnotations (outpath ,imagetoURI )
2493
+ if self .iiif :
2494
+ IIIFAPIExporter .generateIIIFAnnotations (outpath ,imagetoURI )
2493
2495
if self .createIndexPages :
2494
2496
for path in paths :
2495
2497
subgraph = Graph (bind_namespaces = "rdflib" )
@@ -2506,6 +2508,10 @@ def generateOntDocForNameSpace(self, prefixnamespace,dataformat="HTML"):
2506
2508
if nslink in sub :
2507
2509
for tup in self .graph .predicate_objects (sub ):
2508
2510
subgraph .add ((sub , tup [0 ], tup [1 ]))
2511
+ if self .solidexport :
2512
+ subgraph .add ((URIRef (sub .replace ("nslink" ,"" )),URIRef ("http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ),URIRef ("http://www.w3.org/ns/ldp#Container" )))
2513
+ subgraph .add ((URIRef (sub .replace ("nslink" , "" )),URIRef ("http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ),URIRef ("http://www.w3.org/ns/ldp#BasicContainer" )))
2514
+ subgraph .add ((URIRef (sub .replace ("nslink" , "" )),URIRef ("http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ),URIRef ("http://www.w3.org/ns/ldp#Resource" )))
2509
2515
for ex in self .exports :
2510
2516
if ex in ExporterUtils .exportToFunction :
2511
2517
if ex not in ExporterUtils .rdfformats :
@@ -2557,6 +2563,7 @@ def generateOntDocForNameSpace(self, prefixnamespace,dataformat="HTML"):
2557
2563
IIIFAPIExporter .generateIIIFCollections (self .outpath ,self .deploypath ,iiifmanifestpaths ["default" ],prefixnamespace )
2558
2564
if len (featurecollectionspaths )> 0 and self .ckan :
2559
2565
CKANExporter .generateCKANCollection (outpath ,self .deploypath ,featurecollectionspaths ,tree ["core" ]["data" ],self .license )
2566
+ if self .solidexport :
2560
2567
SolidExporter .createSolidSettings (self .graph ,outpath ,self .deploypath ,self .publisher ,self .datasettitle ,tree ["core" ]["data" ])
2561
2568
if len (featurecollectionspaths )> 0 :
2562
2569
relpath = DocUtils .generateRelativePathFromGivenDepth (0 )
@@ -3408,6 +3415,9 @@ def createHTML(self,savepath, predobjs, subject, baseurl, subpreds, graph, searc
3408
3415
tablecontents += "</tr>"
3409
3416
if self .licenseuri != None :
3410
3417
ttlf .add ((subject , URIRef ("http://purl.org/dc/elements/1.1/license" ), URIRef (self .licenseuri )))
3418
+ if self .solidexport != None :
3419
+ ttlf .add ((subject , URIRef ("http://www.w3.org/1999/02/22-rdf-syntax-ns#" ), URIRef ("http://www.w3.org/ns/ldp#Resource" )))
3420
+ ttlf .add ((subject , URIRef ("http://www.w3.org/1999/02/22-rdf-syntax-ns#" ), URIRef ("https://www.iana.org/assignments/media-types/text/turtle#Resource" )))
3411
3421
nonnslink = ""
3412
3422
if nonns :
3413
3423
completesavepath = savepath .replace (":" ,"_" )
@@ -3660,6 +3670,7 @@ def createHTML(self,savepath, predobjs, subject, baseurl, subpreds, graph, searc
3660
3670
parser .add_argument ("-of" ,"--offlinecompat" ,help = "built-result is offline compatible" ,default = False ,type = lambda x : (str (x ).lower () in ['true' ,'1' , 'yes' ]))
3661
3671
parser .add_argument ("-ogc" ,"--ogcapifeatures" ,help = "create ogc api features collections?" ,action = "store" ,default = False ,type = lambda x : (str (x ).lower () in ['true' ,'1' , 'yes' ]))
3662
3672
parser .add_argument ("-iiif" ,"--iiifmanifest" ,help = "create iiif manifests?" ,action = "store" ,default = True ,type = lambda x : (str (x ).lower () in ['true' ,'1' , 'yes' ]))
3673
+ parser .add_argument ("-solid" ,"--solidexport" ,help = "create solid pod deployment?" ,action = "store" ,default = True ,type = lambda x : (str (x ).lower () in ['true' ,'1' , 'yes' ]))
3663
3674
parser .add_argument ("-imgmd" ,"--imagemetadata" ,help = "resolve image metadata?" ,action = "store" ,default = False ,type = lambda x : (str (x ).lower () in ['true' ,'1' , 'yes' ]))
3664
3675
parser .add_argument ("-ckan" ,"--ckanapi" ,help = "create static ckan api docs?" ,action = "store" ,default = True ,type = lambda x : (str (x ).lower () in ['true' ,'1' , 'yes' ]))
3665
3676
parser .add_argument ("-sc" ,"--startconcept" ,help = "the concept suggested for browsing the HTML documentation" ,action = "store" ,default = None )
@@ -3728,9 +3739,9 @@ def createHTML(self,savepath, predobjs, subject, baseurl, subpreds, graph, searc
3728
3739
args .prefixns = pres
3729
3740
print ("Detected " + args .prefixns + " as data namespace" )
3730
3741
if fcounter < len (outpath ):
3731
- docgen = OntDocGeneration (prefixes ,args .prefixns ,args .prefixnsshort ,args .license ,args .labellang ,outpath [fcounter ],g ,args .createIndexPages ,args .createCollections ,args .metadatatable ,args .nonnspages ,args .createvowl ,args .ogcapifeatures ,args .iiifmanifest ,args .ckanapi ,args .localOptimized ,args .imagemetadata ,args .startconcept ,args .deploypath ,args .logourl ,args .templatename ,args .offlinecompat ,dataexports ,args .datasettitle ,args .publisher ,args .publishingorg )
3742
+ docgen = OntDocGeneration (prefixes ,args .prefixns ,args .prefixnsshort ,args .license ,args .labellang ,outpath [fcounter ],g ,args .createIndexPages ,args .createCollections ,args .metadatatable ,args .nonnspages ,args .createvowl ,args .ogcapifeatures ,args .iiifmanifest ,args .ckanapi ,args .solidexport , args . localOptimized ,args .imagemetadata ,args .startconcept ,args .deploypath ,args .logourl ,args .templatename ,args .offlinecompat ,dataexports ,args .datasettitle ,args .publisher ,args .publishingorg )
3732
3743
else :
3733
- docgen = OntDocGeneration (prefixes ,args .prefixns ,args .prefixnsshort ,args .license ,args .labellang ,outpath [- 1 ],g ,args .createIndexPages ,args .createCollections ,args .metadatatable ,args .nonnspages ,args .createvowl ,args .ogcapifeatures ,args .iiifmanifest ,args .ckanapi ,args .localOptimized ,args .imagemetadata ,args .startconcept ,args .deploypath ,args .logourl ,args .templatename ,args .offlinecompat ,dataexports ,args .datasettitle ,args .publisher ,args .publishingorg )
3744
+ docgen = OntDocGeneration (prefixes ,args .prefixns ,args .prefixnsshort ,args .license ,args .labellang ,outpath [- 1 ],g ,args .createIndexPages ,args .createCollections ,args .metadatatable ,args .nonnspages ,args .createvowl ,args .ogcapifeatures ,args .iiifmanifest ,args .ckanapi ,args .solidexport , args . localOptimized ,args .imagemetadata ,args .startconcept ,args .deploypath ,args .logourl ,args .templatename ,args .offlinecompat ,dataexports ,args .datasettitle ,args .publisher ,args .publishingorg )
3734
3745
docgen .generateOntDocForNameSpace (args .prefixns ,dataformat = "HTML" )
3735
3746
except Exception as inst :
3736
3747
print ("Could not parse " + str (fp ))
0 commit comments