6262__author_orcid__ = 'https://orcid.org/0000-0001-8729-0482'
6363
6464
65- def get_package_meta ():
65+ def get_package_meta () -> Dict :
6666 """Reads codemeta.json and returns it as dict"""
6767 with open (__this_dir__ / '../codemeta.json' , 'r' ) as f :
6868 codemeta = json .loads (f .read ())
@@ -172,7 +172,6 @@ def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
172172 skipND : int = 1 ,
173173 structural : bool = True ,
174174 contextual : bool = True ,
175- resolve_keys : bool = True ,
176175 context : Optional [Dict ] = None ,
177176 blank_node_iri_base : Optional [str ] = None
178177 ) -> str :
@@ -189,19 +188,12 @@ def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
189188 considered if structural=True.
190189 structural : bool=True
191190 Include structural information in the JSON-LD output.
192- semantic : bool=True
193- Include semantic information in the JSON-LD output.
194- resolve_keys : bool=True
195- Resolve keys in the JSON-LD output. This is used when semantic=True.
196- If resolve_keys is False and an attribute name in the HDF5 file, which has
197- a predicate is different in its name from the predicate, the attribute name is used.
198- Example: an attribute "name" is associated with "foaf:lastName", then "name" is used
199- and "name": "http://xmlns.com/foaf/0.1/lastName" is added to the context.
191+ contextual : bool=True
192+ Include contextual information in the JSON-LD output.
200193 context: Optional[Dict]
201194 context in form of {prefix: IRI}, e.g. "ssno": "https://matthiasprobst.github.io/ssno#"
202- If resolve_keys is True, this is added to the built-in look-up table to be used in the
203- context part of JSON-LD
204-
195+ blank_node_iri_base: Optional[str]
196+ IRI base used for blank nodes
205197 """
206198 if blank_node_iri_base is not None :
207199 if not isinstance (blank_node_iri_base , (str , HttpUrl )):
@@ -212,20 +204,18 @@ def dump_jsonld_depr(hdf_filename: Union[str, pathlib.Path],
212204
213205 from h5rdmtoolbox .ld .hdf .file import get_serialized_ld
214206 if structural and not contextual :
215- return get_serialized_ld (hdf_filename , blank_node_iri_base , format = "json-ld" , context = context ,
216- contextual = contextual , skipND = skipND )
217- return get_serialized_ld (hdf_filename , blank_node_iri_base , format = "json-ld" , context = context ,
218- contextual = contextual , skipND = skipND )
219- # with File(hdf_filename) as h5:
220- # return jsonld.dumps(
221- # h5,
222- # structural=structural,
223- # resolve_keys=resolve_keys,
224- # context=context,
225- # blank_node_iri_base=blank_node_iri_base,
226- # skipND=skipND,
227- # **kwargs
228- # )
207+ return get_serialized_ld (
208+ hdf_filename ,
209+ blank_node_iri_base ,
210+ format = "json-ld" ,
211+ context = context ,
212+ skipND = skipND )
213+ return get_serialized_ld (
214+ hdf_filename ,
215+ blank_node_iri_base ,
216+ format = "json-ld" ,
217+ context = context ,
218+ skipND = skipND )
229219
230220
231221def serialize (hdf_filename ,
@@ -257,7 +247,7 @@ def build_pyvis_graph(hdf_filename, output_filename="kg-graph.html", notebook=Fa
257247 kg = kglab .KnowledgeGraph ().load_rdf_text (
258248 serialize (hdf_filename , fmt = "ttl" , structural = structural , contextual = contextual )
259249 )
260- VIS_STYLE = style or {
250+ vis_style = style or {
261251 "hdf" : {
262252 "color" : "orange" ,
263253 "size" : 40 ,
@@ -268,7 +258,7 @@ def build_pyvis_graph(hdf_filename, output_filename="kg-graph.html", notebook=Fa
268258 },
269259 }
270260 subgraph = kglab .SubgraphTensor (kg )
271- pyvis_graph = subgraph .build_pyvis_graph (notebook = notebook , style = VIS_STYLE )
261+ pyvis_graph = subgraph .build_pyvis_graph (notebook = notebook , style = vis_style )
272262 pyvis_graph .force_atlas_2based ()
273263 pyvis_graph .show (output_filename )
274264 return pyvis_graph
@@ -372,4 +362,5 @@ def clean_temp_data(full: bool = False):
372362 'File' , 'Group' , 'Dataset' , 'Attribute' ,
373363 'dump' , 'dumps' , 'cv_h5py' , 'lower' , 'Lower' ,
374364 'set_config' , 'get_config' , 'get_ureg' ,
375- 'Convention' , 'jsonld' , 'lazy' , 'DownloadFileManager' )
365+ 'Convention' , 'jsonld' , 'lazy' , 'DownloadFileManager' ,
366+ 'get_package_meta' , 'clean_temp_data' )
0 commit comments