From f120638741ce4e911eed398a5666d123b075d7ba Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Fri, 17 Nov 2023 09:54:53 +0100 Subject: [PATCH 01/14] phone number migration OP-1464 --- ...20231112161533-update-phone-numbers.sparql | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 config/migrations/2023/20231112161533-update-phone-numbers.sparql diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql new file mode 100644 index 0000000..61556c9 --- /dev/null +++ b/config/migrations/2023/20231112161533-update-phone-numbers.sparql @@ -0,0 +1,38 @@ +DELETE { + ?s ?o . +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4) + BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . + BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) +} + +DELETE { + ?s ?o . +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) = "+") + BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . + BIND (CONCAT('tel:', ?removedSpaces, 2) as ?newPhoneNumber) +} + + + From 57e09e9b470fec06d949fb958c647bea36330822 Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Fri, 17 Nov 2023 11:41:06 +0100 Subject: [PATCH 02/14] migration OK --- .../20231112161533-update-phone-numbers.sparql | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql index 61556c9..ce1c0ed 100644 --- a/config/migrations/2023/20231112161533-update-phone-numbers.sparql +++ b/config/migrations/2023/20231112161533-update-phone-numbers.sparql @@ -1,13 +1,15 @@ DELETE { + GRAPH ?g { ?s ?o . + } } INSERT { - GRAPH { + GRAPH ?g { ?s ?newPhoneNumber . } } WHERE { - GRAPH { + GRAPH ?g { ?s ?o . } @@ -15,17 +17,19 @@ WHERE { BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) } - +; DELETE { + GRAPH ?g { ?s ?o . + } } INSERT { - GRAPH { + GRAPH ?g { ?s ?newPhoneNumber . } } WHERE { - GRAPH { + GRAPH ?g { ?s ?o . } From 30f4341e01cc6dfb9f3a4fc55f40462ea199903e Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Mon, 20 Nov 2023 11:03:31 +0100 Subject: [PATCH 03/14] fixnig remarks --- ...20231112161533-update-phone-numbers.sparql | 66 +++++++++++++++---- 1 file changed, 55 insertions(+), 11 deletions(-) diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql index ce1c0ed..d7ac17e 100644 --- a/config/migrations/2023/20231112161533-update-phone-numbers.sparql +++ b/config/migrations/2023/20231112161533-update-phone-numbers.sparql @@ -1,42 +1,86 @@ DELETE { - GRAPH ?g { + GRAPH { ?s ?o . } } INSERT { - GRAPH ?g { + GRAPH { ?s ?newPhoneNumber . } } WHERE { - GRAPH ?g { + GRAPH { ?s ?o . } - FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4) - BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . + FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4 and !regex(?o, ".*[a-zA-Z].*", "i")) + BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) } + ; + DELETE { - GRAPH ?g { + GRAPH { ?s ?o . } } INSERT { - GRAPH ?g { + GRAPH { ?s ?newPhoneNumber . } } WHERE { - GRAPH ?g { + GRAPH { ?s ?o . } - FILTER (SUBSTR(?o, 1, 1) = "+") - BIND(REPLACE(STR(?o),"[. - /]","") AS ?removedSpaces) . - BIND (CONCAT('tel:', ?removedSpaces, 2) as ?newPhoneNumber) + FILTER (SUBSTR(?o, 1, 1) = "+" and !regex(?o, ".*[a-zA-Z].*", "i")) + BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . + BIND (CONCAT('tel:', ?removedSpaces) as ?newPhoneNumber) } +; +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4 and !regex(?o, ".*[a-zA-Z].*", "i")) + BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . + BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) +} + +; + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?newPhoneNumber . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER (SUBSTR(?o, 1, 1) = "+" and !regex(?o, ".*[a-zA-Z].*", "i")) + BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . + BIND (CONCAT('tel:', ?removedSpaces) as ?newPhoneNumber) +} From 866cff52cc58448737873cf002c72288e5d98ac9 Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Tue, 21 Nov 2023 11:09:07 +0100 Subject: [PATCH 04/14] fixed weird + issue --- .../2023/20231112161533-update-phone-numbers.sparql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql index d7ac17e..78d38ac 100644 --- a/config/migrations/2023/20231112161533-update-phone-numbers.sparql +++ b/config/migrations/2023/20231112161533-update-phone-numbers.sparql @@ -35,9 +35,9 @@ WHERE { ?s ?o . } - FILTER (SUBSTR(?o, 1, 1) = "+" and !regex(?o, ".*[a-zA-Z].*", "i")) + FILTER (STRSTARTS(?o, "+") and !regex(?o, ".*[a-zA-Z].*", "i")) BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . - BIND (CONCAT('tel:', ?removedSpaces) as ?newPhoneNumber) + BIND (CONCAT('tel:+', ?removedSpaces) as ?newPhoneNumber) } ; @@ -79,8 +79,8 @@ WHERE { ?s ?o . } - FILTER (SUBSTR(?o, 1, 1) = "+" and !regex(?o, ".*[a-zA-Z].*", "i")) + FILTER (STRSTARTS(?o, "+") and !regex(?o, ".*[a-zA-Z].*", "i")) BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . - BIND (CONCAT('tel:', ?removedSpaces) as ?newPhoneNumber) + BIND (CONCAT('tel:+', ?removedSpaces) as ?newPhoneNumber) } From 674f27bff8402d53ab3ffcf1956ca42bbd83cc69 Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Wed, 29 Nov 2023 09:57:47 +0100 Subject: [PATCH 05/14] saving progress for pr review --- ...20231112161533-update-phone-numbers.sparql | 6 +-- config/reasoner/dl2op/main/phone_number.n3 | 46 +++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 config/reasoner/dl2op/main/phone_number.n3 diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql index 78d38ac..64b78ca 100644 --- a/config/migrations/2023/20231112161533-update-phone-numbers.sparql +++ b/config/migrations/2023/20231112161533-update-phone-numbers.sparql @@ -12,9 +12,8 @@ WHERE { GRAPH { ?s ?o . } - - FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4 and !regex(?o, ".*[a-zA-Z].*", "i")) BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . + FILTER (SUBSTR(?removedSpaces, 1, 1) != "+" AND STRLEN(STR(?removedSpaces)) > 8 AND STRLEN(STR(?removedSpaces)) < 11 and !regex(?o, ".*[a-zA-Z].*", "i")) BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) } @@ -34,9 +33,8 @@ WHERE { GRAPH { ?s ?o . } - - FILTER (STRSTARTS(?o, "+") and !regex(?o, ".*[a-zA-Z].*", "i")) BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . + FILTER (STRSTARTS(?o, "+") and !regex(?o, ".*[a-zA-Z].*", "i")) BIND (CONCAT('tel:+', ?removedSpaces) as ?newPhoneNumber) } diff --git a/config/reasoner/dl2op/main/phone_number.n3 b/config/reasoner/dl2op/main/phone_number.n3 new file mode 100644 index 0000000..db784d8 --- /dev/null +++ b/config/reasoner/dl2op/main/phone_number.n3 @@ -0,0 +1,46 @@ +PREFIX string: +PREFIX e: +PREFIX schema: +#:s :p +# "+32488888888", +# "0477777777", +# "0477.77.77.00", +# "0", +# " +32 445 55 99 91", +# "tel:+3144887755", +# "0032 4 58 44 66 87", +# "00 32 0 498 77 7744". +{ + + + ?s schema:telephone ?number. + + # number not matches regex + + ?number string:notMatches """[a-zA-Z]""". + + # Remove all non digits + ( ?number """[^+\\d]""" "" ) string:replace ?scrape_result. + + # Replace leading 00 with + + ( ?scrape_result """^00""" "+") string:replace ?replaced_zero_zero. + + ( ?replaced_zero_zero """^0""" "+32") string:replace ?default_be. + + ( ?default_be """\\+320""" "+32" ) string:replace ?result. + + # ?result string:matches """^+((32\\d{8})|(324\\d{8})|((?!32)\\d+))$""". + ?result string:matches """^\\+((32\\d{8})|(324\\d{8})|((?!32)\\d+))$""". + + # concat with tel: + ("tel:" ?result) string:concatenation ?parsedNumber . + + { + ?s schema:telephone ?number. + } e:becomes { + ?s schema:telephone ?parsedNumber. + }. + +} => { + ?s schema:telephone ?parsedNumber. +}. From 672b4bce6a119fff0eea7626c09015105b497c33 Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Thu, 30 Nov 2023 10:49:47 +0100 Subject: [PATCH 06/14] reasoner buf fixed --- config/reasoner/dl2op/main/phone_number.n3 | 23 +++++----------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/config/reasoner/dl2op/main/phone_number.n3 b/config/reasoner/dl2op/main/phone_number.n3 index db784d8..4acfd1f 100644 --- a/config/reasoner/dl2op/main/phone_number.n3 +++ b/config/reasoner/dl2op/main/phone_number.n3 @@ -1,19 +1,7 @@ PREFIX string: PREFIX e: -PREFIX schema: -#:s :p -# "+32488888888", -# "0477777777", -# "0477.77.77.00", -# "0", -# " +32 445 55 99 91", -# "tel:+3144887755", -# "0032 4 58 44 66 87", -# "00 32 0 498 77 7744". { - - - ?s schema:telephone ?number. + :s schema:telephone ?number. # number not matches regex @@ -32,15 +20,14 @@ PREFIX schema: # ?result string:matches """^+((32\\d{8})|(324\\d{8})|((?!32)\\d+))$""". ?result string:matches """^\\+((32\\d{8})|(324\\d{8})|((?!32)\\d+))$""". - # concat with tel: - ("tel:" ?result) string:concatenation ?parsedNumber . + ( "tel:" ?result ) string:concatenation ?parsed_result . { - ?s schema:telephone ?number. + :s schema:telephone ?number. } e:becomes { - ?s schema:telephone ?parsedNumber. + :s schema:telephone ?parsed_result . }. } => { - ?s schema:telephone ?parsedNumber. + :s schema:telephone ?parsed_result . }. From 122b51ad0ec64f711fdd3fb76f80e703d928f80f Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Thu, 30 Nov 2023 11:12:02 +0100 Subject: [PATCH 07/14] migration check --- ...02311121615322-update-phone-numbers.sparql | 202 ++++++++++++++++++ ...20231112161533-update-phone-numbers.sparql | 84 -------- 2 files changed, 202 insertions(+), 84 deletions(-) create mode 100644 config/migrations/2023/202311121615322-update-phone-numbers.sparql delete mode 100644 config/migrations/2023/20231112161533-update-phone-numbers.sparql diff --git a/config/migrations/2023/202311121615322-update-phone-numbers.sparql b/config/migrations/2023/202311121615322-update-phone-numbers.sparql new file mode 100644 index 0000000..5e56d80 --- /dev/null +++ b/config/migrations/2023/202311121615322-update-phone-numbers.sparql @@ -0,0 +1,202 @@ +#fix nrs starting with 0032 in Administrative-unit + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?fixedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "0032")) . + BIND(CONCAT("32", SUBSTR(?removedSpaces, 5)) as ?newTel ) . + FILTER(STRLEN(?newTel) > 9 and STRLEN(?newTel) < 12) . + BIND(CONCAT("+", ?newTel) AS ?fixedTel) . +} +; + +#fix nrs starting with 0032 in worship-service + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?fixedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "0032")) . + BIND(CONCAT("32", SUBSTR(?removedSpaces, 5)) as ?newTel ) . + FILTER(STRLEN(?newTel) > 9 and STRLEN(?newTel) < 12) . + BIND(CONCAT("+", ?newTel) AS ?fixedTel) . +} +; + + +#fix nrs starting with 320 in administrative-unit + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?fixedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "320")) . + BIND(CONCAT("32", SUBSTR(?removedSpaces, 4)) as ?newTel ) . + FILTER(STRLEN(?newTel) > 9 and STRLEN(?newTel) < 12) . + BIND(CONCAT("+", ?newTel) AS ?fixedTel) . +} +; +#fix nrs starting with 320 in worship-service + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?fixedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "0032")) . + BIND(CONCAT("+32", SUBSTR(?removedSpaces, 5)) as ?newTel ) . + FILTER(STRLEN(?newTel) > 9 and STRLEN(?newTel) < 12) . + BIND(CONCAT("+", ?newTel) AS ?fixedTel) . +} +; + +#fix nrs starting with 0 in administrative-unit + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?fixedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "0")) . + BIND(CONCAT("32", SUBSTR(?removedSpaces, 2)) as ?newTel ) . + FILTER(STRLEN(?newTel) > 9 and STRLEN(?newTel) < 12) . + BIND(CONCAT("+", ?newTel) AS ?fixedTel) . +} +; + + +#fix nrs starting with 03/04 in worship-service + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?fixedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "0")) . + BIND(CONCAT("32", SUBSTR(?removedSpaces, 2)) as ?newTel ) . + FILTER(STRLEN(?newTel) > 9 and STRLEN(?newTel) < 12) . + BIND(CONCAT("+", ?newTel) AS ?fixedTel) . + +} +; + +#convert all nrs starting with 32 in administrative-unit + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?convertedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "32") AND STRLEN(?removedSpaces) > 9 and STRLEN(?removedSpaces) < 12) . + BIND(CONCAT("tel:+", ?removedSpaces) as ?convertedTel) . +} +; + + +#convert all nrs starting with 32 in worship-service + +DELETE { + GRAPH { + ?s ?o . + } +} +INSERT { + GRAPH { + ?s ?convertedTel . + } +} +WHERE { + GRAPH { + ?s ?o . + } + + FILTER(!regex(?o, ".*[a-zA-Z].*", "i")) . + BIND(REPLACE(STR(?o),"[. -/();:=+]","") AS ?removedSpaces) . + FILTER(STRSTARTS(?removedSpaces, "32") AND STRLEN(?removedSpaces) > 9 and STRLEN(?removedSpaces) < 12) . + BIND(CONCAT("tel:+", ?removedSpaces) as ?convertedTel) . +} +; \ No newline at end of file diff --git a/config/migrations/2023/20231112161533-update-phone-numbers.sparql b/config/migrations/2023/20231112161533-update-phone-numbers.sparql deleted file mode 100644 index 64b78ca..0000000 --- a/config/migrations/2023/20231112161533-update-phone-numbers.sparql +++ /dev/null @@ -1,84 +0,0 @@ -DELETE { - GRAPH { - ?s ?o . - } -} -INSERT { - GRAPH { - ?s ?newPhoneNumber . - } -} -WHERE { - GRAPH { - ?s ?o . - } - BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . - FILTER (SUBSTR(?removedSpaces, 1, 1) != "+" AND STRLEN(STR(?removedSpaces)) > 8 AND STRLEN(STR(?removedSpaces)) < 11 and !regex(?o, ".*[a-zA-Z].*", "i")) - BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) -} - -; - -DELETE { - GRAPH { - ?s ?o . - } -} -INSERT { - GRAPH { - ?s ?newPhoneNumber . - } -} -WHERE { - GRAPH { - ?s ?o . - } - BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . - FILTER (STRSTARTS(?o, "+") and !regex(?o, ".*[a-zA-Z].*", "i")) - BIND (CONCAT('tel:+', ?removedSpaces) as ?newPhoneNumber) -} - -; - -DELETE { - GRAPH { - ?s ?o . - } -} -INSERT { - GRAPH { - ?s ?newPhoneNumber . - } -} -WHERE { - GRAPH { - ?s ?o . - } - - FILTER (SUBSTR(?o, 1, 1) != "+" AND STRLEN(STR(?o)) > 4 and !regex(?o, ".*[a-zA-Z].*", "i")) - BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . - BIND (CONCAT('tel:+32', SUBSTR(?removedSpaces, 2)) as ?newPhoneNumber) -} - -; - -DELETE { - GRAPH { - ?s ?o . - } -} -INSERT { - GRAPH { - ?s ?newPhoneNumber . - } -} -WHERE { - GRAPH { - ?s ?o . - } - - FILTER (STRSTARTS(?o, "+") and !regex(?o, ".*[a-zA-Z].*", "i")) - BIND(REPLACE(STR(?o),"[. -/()]","") AS ?removedSpaces) . - BIND (CONCAT('tel:+', ?removedSpaces) as ?newPhoneNumber) -} - From 4e8af93f236905918f30bd6381c6e44264c126cd Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Thu, 30 Nov 2023 11:43:07 +0100 Subject: [PATCH 08/14] reasoner changes --- config/reasoner/dl2op/main/phone_number.n3 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/reasoner/dl2op/main/phone_number.n3 b/config/reasoner/dl2op/main/phone_number.n3 index 4acfd1f..b6a7a2d 100644 --- a/config/reasoner/dl2op/main/phone_number.n3 +++ b/config/reasoner/dl2op/main/phone_number.n3 @@ -1,7 +1,8 @@ PREFIX string: PREFIX e: +PREFIX schema: { - :s schema:telephone ?number. + ?s schema:telephone ?number. # number not matches regex From 78baadce4fc11606a4ed0ab7f00724a1a7299503 Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Thu, 30 Nov 2023 13:42:39 +0100 Subject: [PATCH 09/14] changed :s to ?s --- config/reasoner/dl2op/main/phone_number.n3 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/reasoner/dl2op/main/phone_number.n3 b/config/reasoner/dl2op/main/phone_number.n3 index b6a7a2d..e04eb47 100644 --- a/config/reasoner/dl2op/main/phone_number.n3 +++ b/config/reasoner/dl2op/main/phone_number.n3 @@ -24,11 +24,11 @@ PREFIX schema: ( "tel:" ?result ) string:concatenation ?parsed_result . { - :s schema:telephone ?number. + ?s schema:telephone ?number. } e:becomes { - :s schema:telephone ?parsed_result . + ?s schema:telephone ?parsed_result . }. } => { - :s schema:telephone ?parsed_result . + ?s schema:telephone ?parsed_result . }. From a944075616b0ae01f03a4ace149f3e6fbf576f43 Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Thu, 30 Nov 2023 18:30:48 +0100 Subject: [PATCH 10/14] updated prefixes --- .../reasoner/dl2op/main-info/phone_number.n3 | 54 +++++++++++++++++++ config/reasoner/dl2op/main/phone_number.n3 | 19 +++++++ 2 files changed, 73 insertions(+) create mode 100644 config/reasoner/dl2op/main-info/phone_number.n3 diff --git a/config/reasoner/dl2op/main-info/phone_number.n3 b/config/reasoner/dl2op/main-info/phone_number.n3 new file mode 100644 index 0000000..0325fd5 --- /dev/null +++ b/config/reasoner/dl2op/main-info/phone_number.n3 @@ -0,0 +1,54 @@ +PREFIX string: +PREFIX e: +PREFIX schema: +PREFIX : <#> +PREFIX adms: +PREFIX adres: +PREFIX besluit: +PREFIX crypto: +PREFIX e: +PREFIX ex: +PREFIX foaf: +PREFIX func: +PREFIX generiek: +PREFIX log: +PREFIX mandaat: +PREFIX mu: +PREFIX org: +PREFIX persoon: +PREFIX persoon_loket: +PREFIX skos: +PREFIX string: +PREFIX xsd: + +{ + ?s schema:telephone ?number. + + # number not matches regex + + ?number string:notMatches """[a-zA-Z]""". + + # Remove all non digits + ( ?number """[^+\\d]""" "" ) string:replace ?scrape_result. + + # Replace leading 00 with + + ( ?scrape_result """^00""" "+") string:replace ?replaced_zero_zero. + + ( ?replaced_zero_zero """^0""" "+32") string:replace ?default_be. + + ( ?default_be """\\+320""" "+32" ) string:replace ?result. + + # ?result string:matches """^+((32\\d{8})|(324\\d{8})|((?!32)\\d+))$""". + ?result string:matches """^\\+((32\\d{8})|(324\\d{8})|((?!32)\\d+))$""". + + ( "tel:" ?result ) string:concatenation ?parsed_result . + + { + ?s schema:telephone ?number. + } e:becomes { + ?s schema:telephone ?parsed_result . + }. + +} => { + ?s schema:telephone ?parsed_result . +}. diff --git a/config/reasoner/dl2op/main/phone_number.n3 b/config/reasoner/dl2op/main/phone_number.n3 index e04eb47..f83f5ad 100644 --- a/config/reasoner/dl2op/main/phone_number.n3 +++ b/config/reasoner/dl2op/main/phone_number.n3 @@ -1,6 +1,25 @@ PREFIX string: PREFIX e: PREFIX schema: +PREFIX : <#> +PREFIX adms: +PREFIX adres: +PREFIX besluit: +PREFIX crypto: +PREFIX e: +PREFIX ex: +PREFIX foaf: +PREFIX func: +PREFIX generiek: +PREFIX log: +PREFIX mandaat: +PREFIX mu: +PREFIX org: +PREFIX persoon: +PREFIX persoon_loket: +PREFIX skos: +PREFIX string: +PREFIX xsd: { ?s schema:telephone ?number. From d5c6a3f66607ece37cd1c2dc0a4f402d8648342e Mon Sep 17 00:00:00 2001 From: Elias Papanikitas Date: Thu, 30 Nov 2023 18:36:54 +0100 Subject: [PATCH 11/14] added rules to maininfo --- config/reasoner/dl2op/main-info/phone_number.n3 | 1 - 1 file changed, 1 deletion(-) diff --git a/config/reasoner/dl2op/main-info/phone_number.n3 b/config/reasoner/dl2op/main-info/phone_number.n3 index 0325fd5..f83f5ad 100644 --- a/config/reasoner/dl2op/main-info/phone_number.n3 +++ b/config/reasoner/dl2op/main-info/phone_number.n3 @@ -20,7 +20,6 @@ PREFIX persoon_loket: PREFIX skos: PREFIX string: PREFIX xsd: - { ?s schema:telephone ?number. From 4dfe1953a700df2c528fb929058957852bcdf929 Mon Sep 17 00:00:00 2001 From: Claire Lovisa Date: Mon, 4 Dec 2023 09:34:07 +0100 Subject: [PATCH 12/14] Bump reasoner service --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index b9d8a59..3e11570 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -232,7 +232,7 @@ services: restart: always logging: *default-logging reasoner: - image: eyereasoner/reasoning-service:increased-stack-limit + image: eyereasoner/reasoning-service:1.0.3 volumes: - ./config/reasoner:/config labels: From bf425b7dbb168365523400435e3f390399c09964 Mon Sep 17 00:00:00 2001 From: Claire Lovisa Date: Mon, 4 Dec 2023 10:24:35 +0100 Subject: [PATCH 13/14] Bump reasoner service --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3e11570..90cc857 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -232,7 +232,7 @@ services: restart: always logging: *default-logging reasoner: - image: eyereasoner/reasoning-service:1.0.3 + image: eyereasoner/reasoning-service:1.0.4 volumes: - ./config/reasoner:/config labels: From 562f463af33e2995d00f4d2d27299ad578db14e1 Mon Sep 17 00:00:00 2001 From: Claire Lovisa Date: Mon, 4 Dec 2023 11:51:52 +0100 Subject: [PATCH 14/14] Add missing rule for contact point of leidinggevenden --- config/reasoner/dl2op/main/query.n3q | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config/reasoner/dl2op/main/query.n3q b/config/reasoner/dl2op/main/query.n3q index b72ce01..1db4e37 100644 --- a/config/reasoner/dl2op/main/query.n3q +++ b/config/reasoner/dl2op/main/query.n3q @@ -26,6 +26,16 @@ ?p ?o . }. +# For functionarissen, the contact point is on the bestuursfunctie and not on the agent in position + +{ + ?s a ; + ?o . + } => { + ?s a ; + ?o . +}. + # Functionarissen should be linked to an igs, agb, apb, gemeente, district, provincie or ocmw only (FOR NOW) { @@ -225,8 +235,6 @@ ?p ?o . }. - - { ?s a ; ?p ?o .