Spyderisk / spyderisk-python

Python module to load and use domain model and system model NQ files
Apache License 2.0
0 stars 1 forks source link

use rdflib namespaces #1

Closed wwaites closed 4 months ago

wwaites commented 4 months ago

It is best to use namespaces with RDFlib rather than simply assembling strings.

Thereafter, is unclear whether there is a good reason to give things new names, e.g. using TYPE instead of RDF.type or AFFECTS instead of CORE.affects.

It would be a natural thing to define a python module that has the Spyderisk namespaces, separate from this particular code that uses it.

scp93ch commented 4 months ago

Thanks for this. The code had moved on quite a bit so I've merged your changes into a different file here: ea00c2b7f69fc7391b903281b1a690553981cc95

scp93ch commented 4 months ago

I agree it is not clear about whether to use what is now PREDICATE['has_control'] or just GRAPH['core'].hasControl. Now I see it is simple to make the URIRefs I am leaning towards just getting rid of the PREDICATE dictionary and using CORE.hasControl. The advantage of having them in a dictionary is that you can see what options you have though.

wwaites commented 4 months ago

I agree it is not clear about whether to use what is now PREDICATE['has_control'] or just GRAPH['core'].hasControl. Now I see it is simple to make the URIRefs I am leaning towards just getting rid of the PREDICATE dictionary and using CORE.hasControl. The advantage of having them in a dictionary is that you can see what options you have though.

The disadvantage of maintaining a dictionary is that when we define a new predicate, you need to update the dictionary and keep it in sync. You could build such a dictionary with a query though.