gtfierro/brick-builder

Convert csv to ttl with multiple equipment

Closed this issue · 2 comments

Hi @gtfierro, after using reconciliation-api I generate a csv file with 4 types of equipment like this:
Screenshot 2021-07-13 at 9 30 24 PM

I use the following template to genreate ttl file

brick = https://brickschema.org/schema/Brick#
rdf = http://www.w3.org/1999/02/22-rdf-syntax-ns#
wkgo = http://example.org/building#

wkgo:$2 rdf:type brick:Chiller
wkgo:$3 rdf:type brick:Water_Pump
wkgo:$4 rdf:type brick:Cooling_Tower
wkgo:$5 rdf:type brick:Main_Header 

wkgo:$1 rdf:type brick:$6 

wkgo:$2 brick:hasPoint wkgo:$1
wkgo:$3 brick:hasPoint wkgo:$1
wkgo:$4 brick:hasPoint wkgo:$1
wkgo:$5 brick:hasPoint wkgo:$1

After converting there are long list like all equipment has all point at the top.

wkgo: a brick:Chiller,
        brick:Cooling_Tower,
        brick:Main_Header,
        brick:Water_Pump ;
    brick:hasPoint wkgo:CHWP-CP-BF-01.FLOW.STS,
        wkgo:CHWP-CP-BF-01.RUN.STS,
        wkgo:CHWP-CP-BF-01:KW,
        wkgo:CHWP-CP-BF-01:MWH,
        wkgo:CHWP-CP-BF-02.FLOW.STS,
        wkgo:CHWP-CP-BF-02.RUN.STS,
        wkgo:CHWP-CP-BF-02:KW,
        wkgo:CHWP-CP-BF-02:MWH,
        wkgo:CHWP-CP-BF-03.FLOW.STS,
        wkgo:CHWP-CP-BF-03.RUN.STS,
        wkgo:CHWP-CP-BF-03:KW,
        wkgo:CHWP-CP-BF-03:MWH,
        wkgo:CHWP-CP-BF-04.FLOW.STS,
        wkgo:CHWP-CP-BF-04.RUN.STS,
        wkgo:CHWP-CP-BF-04:KW,
        wkgo:CHWP-CP-BF-04:MWH,
        wkgo:CHWP-CP-BF-05.FLOW.STS,
        wkgo:CHWP-CP-BF-05.RUN.STS,
        wkgo:CHWP-CP-BF-05:KW,
        wkgo:CHWP-CP-BF-05:MWH,
        wkgo:CHWP-CP-BF-06.FLOW.STS,
        wkgo:CHWP-CP-BF-06.RUN.STS,

But the following list is normal:

wkgo:CHWP-CP-BF-01 a brick:Water_Pump ;
    brick:hasPoint wkgo:CHWP-CP-BF-01.FLOW.STS,
        wkgo:CHWP-CP-BF-01.RUN.STS,
        wkgo:CHWP-CP-BF-01:KW,
        wkgo:CHWP-CP-BF-01:MWH .

wkgo:CHWP-CP-BF-02 a brick:Water_Pump ;
    brick:hasPoint wkgo:CHWP-CP-BF-02.FLOW.STS,
        wkgo:CHWP-CP-BF-02.RUN.STS,
        wkgo:CHWP-CP-BF-02:KW,
        wkgo:CHWP-CP-BF-02:MWH .

Can I disable the all equipment has all point SPO to reduce the list size?

Hi @s0301132 ---- thanks for raising this issue. I just pushed a change to brick-builder that should do the right thing now. Before, there was nothing that had brick-builder ignore the empty rows: this is what you were seeing. If you pull the latest from this repo, then it should avoid firing any template rules for rows which don't have the required values.

As an example, consider the template

brick = https://brickschema.org/schema/Brick#
rdf = http://www.w3.org/1999/02/22-rdf-syntax-ns#
bldg = http://example.org/building#

bldg:$3 brick:hasPoint bldg:$2
bldg:$3 brick:hasPoint bldg:$1
bldg:$1 rdf:type brick:Sensor
bldg:$2 rdf:type brick:Setpoint

and the file

sensor,sp,vav
,sp1,vav1
sensor1,,vav1
,sp2,vav2
sensor2,,vav2

This will produce the file:

@prefix bldg: <http://example.org/building#> .
@prefix brick: <https://brickschema.org/schema/Brick#> .
bldg:vav1 brick:hasPoint bldg:sensor1,
        bldg:sp1 .
bldg:vav2 brick:hasPoint bldg:sensor2,
        bldg:sp2 .
bldg:sensor1 a brick:Sensor .
bldg:sensor2 a brick:Sensor .
bldg:sp1 a brick:Setpoint .
bldg:sp2 a brick:Setpoint .

instead of

@prefix bldg: <http://example.org/building#> .
@prefix brick: <https://brickschema.org/schema/Brick#> .
bldg:vav1 brick:hasPoint bldg:,
        bldg:sensor1,
        bldg:sp1 .
bldg:vav2 brick:hasPoint bldg:,
        bldg:sensor2,
        bldg:sp2 .
bldg:sensor1 a brick:Sensor .
bldg:sensor2 a brick:Sensor .
bldg:sp1 a brick:Setpoint .
bldg:sp2 a brick:Setpoint .
bldg: a brick:Sensor,
        brick:Setpoint .

Can you give the new code a try and let me know if it fixes your issue?

@gtfierro with the latest build the program can ignore the null value, thanks!