Skip to content

Commit

Permalink
verwerk PubliekrechtelijkeBeperking
Browse files Browse the repository at this point in the history
  • Loading branch information
mprins committed Dec 15, 2022
1 parent 48e6640 commit 6216972
Show file tree
Hide file tree
Showing 7 changed files with 201 additions and 154 deletions.
227 changes: 106 additions & 121 deletions brmo-loader/src/main/java/nl/b3p/brmo/loader/RsgbProxy.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
Expand Down
82 changes: 65 additions & 17 deletions brmo-loader/src/main/resources/xsl/brk2-snapshot-to-rsgb-xml.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
xmlns:OnroerendeZaak-ref="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-onroerendezaak-ref/v20210702"
xmlns:Persoon="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-persoon/v20210903"
xmlns:Persoon-ref="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-persoon-ref/v20210702"
xmlns:PubliekrechtelijkeBeperking="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-publiekrechtelijkebeperking/v20210702"
xmlns:PubliekrechtelijkeBeperking-ref="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-publiekrechtelijkebeperking-ref/v20210702"
xmlns:Recht="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-recht/v20210903"
xmlns:Recht-ref="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-recht-ref/v20210702"
xmlns:Stuk="http://www.kadaster.nl/schemas/brk-levering/snapshot/imkad-stuk/v20211119"
Expand All @@ -22,8 +24,9 @@
xmlns:KIMNHRRechtspersoon="http://www.kadaster.nl/schemas/brk-levering/snapshot/kimnhr-rechtspersoon/v20210702"
version="1.0">

<!-- <xsl:strip-space elements="*"/>-->
<!-- <xsl:output indent="yes" method="xml" encoding="UTF-8" omit-xml-declaration="no"/>-->
<!-- <xsl:strip-space elements="*"/>-->
<!-- method="xml" omit-xml-declaration="no" -->
<!-- <xsl:output encoding="UTF-8" version="1.0" standalone="yes" indent="yes" />-->

<!-- parameters van het bericht -->
<xsl:param name="objectRef" select="'NL.KAD.OnroerendeZaak:onbekend'"/>
Expand All @@ -37,9 +40,7 @@
<xsl:variable name="toestandsdatum" select="Snapshot:KadastraalObjectSnapshot/Snapshot:toestandsdatum"/>

<xsl:template match="/">
<xsl:text>&#xa;</xsl:text>
<root>
<xsl:text>&#xa;</xsl:text>
<xsl:comment>
<xsl:text>objectRef: </xsl:text>
<xsl:value-of select="$objectRef"/>
Expand All @@ -50,18 +51,6 @@
<xsl:text>, soort: </xsl:text>
<xsl:value-of select="$soort"/>
</xsl:comment>
<xsl:text>&#xa;</xsl:text>
<xsl:comment>
<xsl:text>debug info: </xsl:text>
<xsl:text>&#xa;</xsl:text>
<xsl:text>kad_oz_id: </xsl:text><xsl:value-of select="$kad_oz_id"/>
<xsl:text>&#xa;</xsl:text>
<xsl:text>toestandsdatum: </xsl:text><xsl:value-of select="$toestandsdatum"/>
<xsl:text>&#xa;</xsl:text>
</xsl:comment>
<xsl:text>&#xa;</xsl:text>


<data>
<xsl:if test="not(/Snapshot:KadastraalObjectSnapshot)">
<!--
Expand Down Expand Up @@ -89,7 +78,6 @@
<xsl:apply-templates select="."/>
</xsl:for-each>

<!-- TODO <xsl:for-each select="/Snapshot:KadastraalObjectSnapshot/Recht:Aantekening"> <xsl:apply-templates select="."/> </xsl:for-each>-->

<xsl:apply-templates select="/Snapshot:KadastraalObjectSnapshot/OnroerendeZaak:Perceel"/>

Expand All @@ -110,10 +98,70 @@
</xsl:if>
</xsl:for-each>

<xsl:for-each
select="/Snapshot:KadastraalObjectSnapshot/PubliekrechtelijkeBeperking:PubliekrechtelijkeBeperking">
<xsl:apply-templates select="."/>
</xsl:for-each>
</data>
</root>
</xsl:template>

<xsl:template match="/Snapshot:KadastraalObjectSnapshot/PubliekrechtelijkeBeperking:PubliekrechtelijkeBeperking">
<!-- vult onroerendezaakbeperking en publiekrechtelijkebeperking -->
<publiekrechtelijkebeperking>
<identificatie>
<xsl:call-template name="domein_identificatie">
<xsl:with-param name="id" select="PubliekrechtelijkeBeperking:identificatie"/>
</xsl:call-template>
</identificatie>
<grondslag>
<xsl:value-of select="PubliekrechtelijkeBeperking:grondslag/Typen:waarde"/>
</grondslag>
<datuminwerking>
<xsl:value-of select="PubliekrechtelijkeBeperking:datumInWerking"/>
</datuminwerking>
<datumbeeindiging>
<xsl:value-of select="PubliekrechtelijkeBeperking:datumBeeindiging"/>
</datumbeeindiging>
<isgebaseerdop>
<!-- stukdeel ref -->
<xsl:call-template name="domein_identificatie">
<xsl:with-param name="id" select="PubliekrechtelijkeBeperking:isGebaseerdOp/Stuk-ref:StukdeelRef"/>
</xsl:call-template>
</isgebaseerdop>
<bevoegdgezag>
<!-- TODO NNP referentie
zoek de bevoegdgezag
../PubliekrechtelijkeBeperking:BevoegdGezag/PubliekrechtelijkeBeperking:is/Persoon-ref:NietNatuurlijkPersoonRef
welke verwijst naar deze publiekrechtelijkebeperking met
../PubliekrechtelijkeBeperking:BevoegdGezag/PubliekrechtelijkeBeperking:beheert/PubliekrechtelijkeBeperking-ref:PubliekrechtelijkeBeperkingRef
-->
</bevoegdgezag>
</publiekrechtelijkebeperking>


<xsl:for-each select="PubliekrechtelijkeBeperking:leidtTot">
<onroerendezaakbeperking>
<inonderzoek>
<xsl:value-of select="PubliekrechtelijkeBeperking:inOnderzoek"/>
</inonderzoek>
<beperkt>
<xsl:call-template name="domein_identificatie">
<!-- TODO check of ook voor appartementsrecht -->
<xsl:with-param name="id"
select="PubliekrechtelijkeBeperking:beperkt/OnroerendeZaak-ref:PerceelRef"/>
</xsl:call-template>
</beperkt>
<leidttot>
<!-- publiekrechtelijkebeperking ref / VARCHAR REFERENCES publiekrechtelijkebeperking (identificatie)-->
<xsl:call-template name="domein_identificatie">
<xsl:with-param name="id" select="../PubliekrechtelijkeBeperking:identificatie"/>
</xsl:call-template>
</leidttot>
</onroerendezaakbeperking>
</xsl:for-each>
</xsl:template>

<xsl:template match="/Snapshot:KadastraalObjectSnapshot/Adres:* | KIMBAGAdres:Verblijfsobject">
<adres ignore-duplicates="yes">
<identificatie>
Expand Down
30 changes: 19 additions & 11 deletions brmo-loader/src/test/java/nl/b3p/Brk2ToStagingIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ class Brk2ToStagingIntegrationTest extends AbstractDatabaseIntegrationTest {

static Stream<Arguments> argumentsProvider() {
return Stream.of(
// { "filename", objectRef, aantalBerichten, aantalProcessen, aantalRecht, aantalStuk, aantalNP, aantalNNP, aantalAdres},
arguments("/brk2/stand-appre-1.anon.xml", "NL.IMKAD.KadastraalObject:53761288010001", 1, 1, 3, 2, 1, 1, 3),
arguments("/brk2/stand-perceel-1.anon.xml", "NL.IMKAD.KadastraalObject:50247970000", 1, 1, 2, 1, 0, 1, 2),
arguments("/brk2/stand-perceel-2.anon.xml", "NL.IMKAD.KadastraalObject:53730000170000", 1, 1, 2, 1, 0, 1, 2),
arguments("/brk2/stand-perceel-3.anon.xml", "NL.IMKAD.KadastraalObject:89760037170000", 1, 1, 2, 2, 1, 1, 4),
arguments("/brk2/MUTKX02-ABG00F1856-20211012-1.anon.xml", "NL.IMKAD.KadastraalObject:5260185670000", 1, 1, 3, 2, 2, 0, 2),
arguments("/brk2/MUTKX02-ABG00F1856-20211102-1.anon.xml", "NL.IMKAD.KadastraalObject:5260185670000", 1, 1, 3, 2, 1, 1, 2)
// { "filename", objectRef, aantalBerichten, aantalProcessen, aantalRecht, aantalStuk, aantalNP, aantalNNP, aantalAdres, aantalPubliekRBeperking, aantalOnrndZkBeperking},
arguments("/brk2/stand-appre-1.anon.xml", "NL.IMKAD.KadastraalObject:53761288010001", 1, 1, 3, 2, 1, 1, 3, 0, 0),
arguments("/brk2/stand-perceel-1.anon.xml", "NL.IMKAD.KadastraalObject:50247970000", 1, 1, 2, 1, 0, 1, 2, 0, 0),
arguments("/brk2/stand-perceel-2.anon.xml", "NL.IMKAD.KadastraalObject:53730000170000", 1, 1, 2, 1, 0, 1, 2, 0, 0),
arguments("/brk2/stand-perceel-3.anon.xml", "NL.IMKAD.KadastraalObject:89760037170000", 1, 1, 2, 2, 1, 1, 4, 1, 1),
arguments("/brk2/MUTKX02-ABG00F1856-20211012-1.anon.xml", "NL.IMKAD.KadastraalObject:5260185670000", 1, 1, 3, 2, 2, 0, 2, 0, 0),
arguments("/brk2/MUTKX02-ABG00F1856-20211102-1.anon.xml", "NL.IMKAD.KadastraalObject:5260185670000", 1, 1, 3, 2, 1, 1, 2, 0, 0)
);
}

Expand Down Expand Up @@ -140,12 +140,13 @@ void cleanup() throws Exception {
@ParameterizedTest(name = "testBrk2XMLToStaging #{index}: bestand: {0}, object ref: {1}")
@MethodSource("argumentsProvider")
void testBrk2XMLToStaging(String bestandNaam, String objectRef, long aantalBerichten, long aantalProcessen,
int aantalRecht, int aantalStuk, int aantalNP, int aantalNNP, int aantalAdres)
int aantalRecht, int aantalStuk, int aantalNP, int aantalNNP, int aantalAdres,
int aantalPubliekRBeperking, int aantalOnrndZkBeperking)
throws Exception {

assumeFalse(null == Brk2ToStagingIntegrationTest.class.getResource(bestandNaam), "Het test bestand moet er zijn.");

brmo.loadFromFile(BrmoFramework.BR_BRK2, Brk2ToStagingIntegrationTest.class.getResource(bestandNaam).getFile(), null);
brmo.loadFromFile(BrmoFramework.BR_BRK2, Objects.requireNonNull(Brk2ToStagingIntegrationTest.class.getResource(bestandNaam)).getFile(), null);
LOG.debug("klaar met laden van berichten in staging DB.");

List<Bericht> berichten = brmo.listBerichten();
Expand Down Expand Up @@ -181,9 +182,16 @@ void testBrk2XMLToStaging(String bestandNaam, String objectRef, long aantalBeric
assertEquals(aantalBerichten, onroerendezaak.getRowCount(), "Er is geen (of teveel) onroerendezaak");
assertEquals(objectRef, onroerendezaak.getValue(0, "identificatie"),
"identificatie is niet gelijk aan objectRef");


ITable publiekrechtelijkebeperking = rsgbBrk.createDataSet().getTable("publiekrechtelijkebeperking");
assertEquals(aantalPubliekRBeperking, publiekrechtelijkebeperking.getRowCount(), "Aantal publiekrechtelijkebeperking klopt niet");

ITable onroerendezaakbeperking = rsgbBrk.createDataSet().getTable("onroerendezaakbeperking");
assertEquals(aantalPubliekRBeperking, onroerendezaakbeperking.getRowCount(), "Aantal onroerendezaakbeperking klopt niet");


ITable onroerendezaakfiliatie = rsgbBrk.createDataSet().getTable("onroerendezaakfiliatie");
ITable publiekrechtelijkebeperking = rsgbBrk.createDataSet().getTable("publiekrechtelijkebeperking");

ITable perceelOfAppRe;
if (isPerceel) {
Expand All @@ -192,7 +200,7 @@ void testBrk2XMLToStaging(String bestandNaam, String objectRef, long aantalBeric
"Perceel identificatie is niet gelijk aan objectRef");
// TODO
// assertNotNull(perceelOfAppRe.getValue(0, "begrenzing_perceel"), "Perceel begrenzing geometrie is 'null'");
// assertNotNull(perceelOfAppRe.getValue(0, "plaatscoordinaten"), "Plaatscoordinaten geometrie is 'null'");
//assertNotNull(perceelOfAppRe.getValue(0, "plaatscoordinaten"), "Plaatscoordinaten geometrie is 'null'");
} else {
perceelOfAppRe = rsgbBrk.createDataSet().getTable("appartementsrecht");
assertEquals(objectRef, perceelOfAppRe.getValue(0, "identificatie"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,17 @@ public static void cleanRSGB_BRK2(final IDatabaseConnection rsgbbrk)
new DefaultTable("nietnatuurlijkpersoon"),
new DefaultTable("onroerendezaak"),
new DefaultTable("perceel"),
new DefaultTable("onroerendezaakbeperking"),
new DefaultTable("onroerendezaakfiliatie"),
new DefaultTable("publiekrechtelijkebeperking"),




new DefaultTable("stuk"),
new DefaultTable("stukdeel"),
new DefaultTable("recht"),
new DefaultTable("appartementsrecht"),
new DefaultTable("publiekrechtelijkebeperking"),
new DefaultTable("onroerendezaakbeperking"),
new DefaultTable("archief_appartementsrecht"),
new DefaultTable("archief_onroerendezaak"),
new DefaultTable("archief_onroerendezaakfiliatie"),
Expand Down
1 change: 0 additions & 1 deletion datamodel/brk/brk2.0_oracle.sql
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ CREATE TABLE publiekrechtelijkebeperking
);
CREATE TABLE onroerendezaakbeperking
(
identificatie VARCHAR2(255) PRIMARY KEY NOT NULL,
inonderzoek NUMBER(1),
beperkt VARCHAR2(255) REFERENCES onroerendezaak (identificatie),
leidttot VARCHAR2(255) REFERENCES publiekrechtelijkebeperking (identificatie)
Expand Down
5 changes: 3 additions & 2 deletions datamodel/brk/brk2.0_postgresql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,11 @@ CREATE TABLE publiekrechtelijkebeperking

CREATE TABLE onroerendezaakbeperking
(
identificatie VARCHAR(255) PRIMARY KEY NOT NULL,
-- geen identificatie?
-- identificatie VARCHAR(255) PRIMARY KEY NOT NULL,
-- TODO primary key bepalen
inonderzoek BOOLEAN,
beperkt VARCHAR REFERENCES onroerendezaak (identificatie),
-- publiekrechtelijkebeperking ref
leidttot VARCHAR REFERENCES publiekrechtelijkebeperking (identificatie)
);

Expand Down

0 comments on commit 6216972

Please sign in to comment.