diff --git a/code/script.py b/code/script.py index 0e51922..5be9bb8 100644 --- a/code/script.py +++ b/code/script.py @@ -72,10 +72,17 @@ def add_to_context(uri): context[name] = {"@id": str(uri)} class_obj = RdfClass(name=name, uri=uri) classes[uri] = class_obj - for s1, p1, o1 in g.triples((class_obj.uri, None, None)): - class_obj.__dict__[short_name(p1)] = o1 + fill_object(class_obj) for s, p, o in g.triples((None, RDFS.subClassOf, uri)): - add_to_context(s) + add_to_context(s) + + if hasattr(class_obj, 'targetClass'): + owl_class = RdfClass(name=name, uri=class_obj.targetClass) + fill_object(owl_class) + if owl_class.description and owl_class.description != '': + print(f'description: {owl_class.description}') + class_obj.description = owl_class.description + for s, p, o in g.triples((uri, SH.property, None)): property_name = short_name(o) property_name = property_name.replace(f'{name}-', '') @@ -99,6 +106,11 @@ def add_to_context(uri): # context[name] = {"@id": str(uri)} +def fill_object(obj): + for s1, p1, o1 in g.triples((obj.uri, None, None)): + obj.__dict__[short_name(p1)] = o1 + + # Add classes and properties to the context for class_uri in g.subjects(): add_to_context(class_uri) diff --git a/docs/respec/template.html b/docs/respec/template.html index 427c5c3..d874b30 100644 --- a/docs/respec/template.html +++ b/docs/respec/template.html @@ -170,10 +170,10 @@

Data Product (DPROD) Model

"outputPort": { "@type": "dcat:DataService", "dcat:endpointURL": "https://y.com/uk-10-year-bonds", - "offersDistribution": { + "isAccessServiceOf": { "@type": "dcat:Distribution", "dcterms:format": "https://www.iana.org/assignments/media-types/application/json", - "belongsToDataset": { + "isDistributionOf": { "@type": "dcat:Dataset", "dcat:conformsTo": "https://spec.edmcouncil.org/fibo/ontology/SEC/Debt/Bonds/CallableBond" }