From 54e381bfad96b373475ba724b40d5d4e4c5f9452 Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Tue, 5 Dec 2023 11:58:54 +0100 Subject: [PATCH 1/2] converted-date-to-datetime --- ...1205094320-mandaat-date-to-datetime.sparql | 110 ++++++++++++++++++ config/resources/domain.json | 10 +- 2 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 config/migrations/2023/20231205094320-mandaat-date-to-datetime.sparql diff --git a/config/migrations/2023/20231205094320-mandaat-date-to-datetime.sparql b/config/migrations/2023/20231205094320-mandaat-date-to-datetime.sparql new file mode 100644 index 0000000..0db4d31 --- /dev/null +++ b/config/migrations/2023/20231205094320-mandaat-date-to-datetime.sparql @@ -0,0 +1,110 @@ +PREFIX mandaat: +PREFIX ch: +PREFIX ere: +PREFIX xsd: +DELETE { + GRAPH ?g { + ?s mandaat:start ?o . + } +} +INSERT { + GRAPH ?g { + ?s mandaat:start ?converteddate . + } +} +WHERE { + GRAPH ?g { + ?s mandaat:start ?o . + } + VALUES ?g { + + + } + BIND(xsd:dateTime(?o) AS ?converteddate). +} +; +DELETE { + GRAPH ?g { + ?s mandaat:einde ?o . + } + } + INSERT { + GRAPH ?g { + ?s mandaat:einde ?converteddate . + } + } + WHERE { + GRAPH ?g { + ?s mandaat:einde ?o . + } + VALUES ?g { + + + } + BIND(xsd:dateTime(?o) AS ?converteddate). + } + +; +DELETE { + GRAPH ?g { + ?s ch:startdatum ?o . + } +} +INSERT { + GRAPH ?g { + ?s ch:startdatum ?converteddate . + } +} +WHERE { + GRAPH ?g { + ?s ch:startdatum ?o . + } + VALUES ?g { + + + } + BIND(xsd:dateTime(?o) AS ?converteddate). +} +; +DELETE { + GRAPH ?g { + ?s ch:eindedatum ?o . + } + } + INSERT { + GRAPH ?g { + ?s ch:eindedatum ?converteddate . + } + } + WHERE { + GRAPH ?g { + ?s ch:eindedatum ?o . + } + VALUES ?g { + + + } + BIND(xsd:dateTime(?o) AS ?converteddate). + } +; + DELETE { + GRAPH ?g { + ?s ere:geplandeEinddatumAanstelling ?o . + } + } + INSERT { + GRAPH ?g { + ?s ere:geplandeEinddatumAanstelling ?converteddate . + } + } + WHERE { + GRAPH ?g { + ?s ere:geplandeEinddatumAanstelling ?o . + } + VALUES ?g { + + + } + BIND(xsd:dateTime(?o) AS ?converteddate). + } + ; \ No newline at end of file diff --git a/config/resources/domain.json b/config/resources/domain.json index 7a33825..5c67e33 100644 --- a/config/resources/domain.json +++ b/config/resources/domain.json @@ -92,11 +92,11 @@ "super": ["agents"], "attributes": { "agent-start-date": { - "type": "date", + "type": "datetime", "predicate": "ch:startdatum" }, "agent-end-date": { - "type": "date", + "type": "datetime", "predicate": "ch:eindedatum" } }, @@ -140,11 +140,11 @@ "super": ["agents-in-position"], "attributes": { "start-date": { - "type": "date", + "type": "datetime", "predicate": "mandaat:start" }, "end-date": { - "type": "date", + "type": "datetime", "predicate": "mandaat:einde" } }, @@ -188,7 +188,7 @@ "super": ["mandatories"], "attributes": { "expected-end-date": { - "type": "date", + "type": "datetime", "predicate": "ere:geplandeEinddatumAanstelling" }, "reason-stopped": { From 663c975725e718c8e82df17bf35625070fd1863c Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Tue, 19 Dec 2023 10:50:50 +0100 Subject: [PATCH 2/2] removed datetime to date conversions from reasoner --- config/reasoner/dl2op/main-info/mapping.n3 | 28 ------------ config/reasoner/dl2op/main/mapping.n3 | 53 ---------------------- 2 files changed, 81 deletions(-) diff --git a/config/reasoner/dl2op/main-info/mapping.n3 b/config/reasoner/dl2op/main-info/mapping.n3 index ec1a9a1..4d7158b 100644 --- a/config/reasoner/dl2op/main-info/mapping.n3 +++ b/config/reasoner/dl2op/main-info/mapping.n3 @@ -68,34 +68,6 @@ PREFIX ere: }. # Test -# ex:s "2019-01-01T19:32:52+00:00"^^xsd:dateTime. -{ - ?s mandaat:start ?startDateTime. - # use backward arrow rule defined below - ?startDateTime :dateFromDateTime ?startDate. - { - ?s mandaat:start ?startDateTime - } e:becomes { - ?s mandaat:start ?startDate - }. -} => { - ?s mandaat:start ?startDate -}. - -# ex:s "2019-02-01T10:32:52+00:00"^^xsd:dateTime. -{ - ?s mandaat:einde ?eindeDateTime. - # use backward arrow rule defined below - ?eindeDateTime :dateFromDateTime ?eindeDate. - { - ?s mandaat:einde ?eindeDateTime - } e:becomes { - ?s mandaat:einde ?eindeDate - }. -} => { - ?s mandaat:einde ?eindeDate -}. - # Backward arrow rule is like a function call. # Removes time info in the returned date diff --git a/config/reasoner/dl2op/main/mapping.n3 b/config/reasoner/dl2op/main/mapping.n3 index 0f79ceb..f280bf8 100644 --- a/config/reasoner/dl2op/main/mapping.n3 +++ b/config/reasoner/dl2op/main/mapping.n3 @@ -67,59 +67,6 @@ PREFIX lblodlg: }. # Test -# ex:s "2019-01-01T19:32:52+00:00"^^xsd:dateTime. -{ - ?s mandaat:start ?startDateTime. - # use backward arrow rule defined below - ?startDateTime :dateFromDateTime ?startDate. - { - ?s mandaat:start ?startDateTime - } e:becomes { - ?s mandaat:start ?startDate - }. -} => { - ?s mandaat:start ?startDate -}. - -# ex:s "2019-02-01T10:32:52+00:00"^^xsd:dateTime. -{ - ?s mandaat:einde ?eindeDateTime. - # use backward arrow rule defined below - ?eindeDateTime :dateFromDateTime ?eindeDate. - { - ?s mandaat:einde ?eindeDateTime - } e:becomes { - ?s mandaat:einde ?eindeDate - }. -} => { - ?s mandaat:einde ?eindeDate -}. - -{ - ?s mandaat:bindingStart ?bindingStartDateTime. - # use backward arrow rule defined below - ?bindingStartDateTime :dateFromDateTime ?bindingStartDate. - { - ?s mandaat:bindingStart ?bindingStartDateTime - } e:becomes { - ?s mandaat:bindingStart ?bindingStartDate - }. -} => { - ?s mandaat:bindingStart ?bindingStartDate -}. - -{ - ?s mandaat:bindingEinde ?bindingEindeDateTime. - # use backward arrow rule defined below - ?bindingEindeDateTime :dateFromDateTime ?bindingEindeDate. - { - ?s mandaat:bindingEinde ?bindingEindeDateTime - } e:becomes { - ?s mandaat:bindingEinde ?bindingEindeDate - }. -} => { - ?s mandaat:bindingEinde ?bindingEindeDate -}. # Backward arrow rule is like a function call. # Removes time info in the returned date