diff --git a/concepttordf/concept.py b/concepttordf/concept.py index 6d393a8..e5035a2 100644 --- a/concepttordf/concept.py +++ b/concepttordf/concept.py @@ -55,12 +55,12 @@ def alternativeterm(self, alternativeterm: dict): self._alternativeterm = alternativeterm @property - def hiddenterm(self) -> dict: - return self._hiddenterm + def datastrukturterm(self) -> dict: + return self._datastrukturterm - @hiddenterm.setter - def hiddenterm(self, hiddenterm: dict): - self._hiddenterm = hiddenterm + @datastrukturterm.setter + def datastrukturterm(self, datastrukturterm: dict): + self._datastrukturterm = datastrukturterm @property def subject(self) -> dict: @@ -253,6 +253,22 @@ def _add_concept_to_graph(self): self._g.add((URIRef(self.identifier), SKOSXL.hiddenLabel, hiddenLabel)) + # datastrukturterm + if hasattr(self, 'datastrukturterm'): + datastrukturterm = BNode() + self._g.add((datastrukturterm, RDF.type, SKOSXL.Label)) + if 'name' in self.datastrukturterm: + _name = self.datastrukturterm['name'] + for key in _name: + for l in _name[key]: + self._g.add((datastrukturterm, SKOSXL.literalForm, + Literal(l, lang=key))) + if 'modified' in self.datastrukturterm: + self._g.add((datastrukturterm, DCT.modified, + Literal(self.datastrukturterm['modified'], + datatype=XSD.date))) + self._g.add((URIRef(self.identifier), + SKOSNO.datastrukturterm, datastrukturterm)) # definition if hasattr(self, 'definition'): self._add_betydningsbeskrivelse_to_concept(self.definition) diff --git a/setup.py b/setup.py index ea80d62..8db78d8 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="concepttordf", - version="1.0.0.rc3", + version="1.0.0.rc4", author="Stig B. Dørmænen", author_email="sbd@digdir.no", description=( diff --git a/tests/completeconcept.json b/tests/completeconcept.json index 7e8816d..a000c14 100644 --- a/tests/completeconcept.json +++ b/tests/completeconcept.json @@ -25,6 +25,12 @@ }, "modified": "2020-03-03" }, + "datastrukturterm": { + "name": { + "en": ["completeConcept"] + }, + "modified": "2020-03-13" + }, "subject": { "en": "terminology", "nb": "termonologi", diff --git a/tests/completeconcept.ttl b/tests/completeconcept.ttl index 483880b..b40293f 100644 --- a/tests/completeconcept.ttl +++ b/tests/completeconcept.ttl @@ -68,6 +68,10 @@ skosxl:literalForm "completeconcept"@en , "kompletomgrep"@nn , "kompletbegrep"@nb ; dct:modified "2020-03-03"^^xsd:date ; ] ; + skosno:datastrukturterm [ a skosxl:Label ; + skosxl:literalForm "completeConcept"@en ; + dct:modified "2020-03-13"^^xsd:date ; + ] ; dcat:contactPoint [ a vcard:Organization ; vcard:hasEmail ; vcard:hasOrganizationName "Norwegian Digitalisation Agency"@en, diff --git a/tests/test_concept.py b/tests/test_concept.py index a849fa9..f55dd1d 100644 --- a/tests/test_concept.py +++ b/tests/test_concept.py @@ -53,6 +53,7 @@ def test_concept_to_rdf_should_return_skos_concept(): concept.term = _concept['term'] concept.alternativeterm = _concept['alternativeterm'] concept.hiddenterm = _concept['hiddenterm'] + concept.datastrukturterm = _concept['datastrukturterm'] # Definisjon definition = Definition() definition.text = _concept['definition']['text']