BrickSchema / Brick

Uniform metadata schema for buildings
http://brickschema.org/
BSD 3-Clause "New" or "Revised" License
289 stars 78 forks source link

Questions about the bacnet ontology #622

Closed arrascue closed 1 week ago

arrascue commented 5 months ago

Hello,

I was wondering where to get the complete bacnet ontology from. I was trying to model a Bacnet device as shown in the brick documentation. In the example, a bacnet device has type bacnet:BACnetDevice.

We have a strict validation pipeline, which verifies that all classes have semantics, i.e. whether all classes are correctly defined. If I take a look at Brick/master/support/bacnet.ttl I cannot find a class definition for this and other classes, so I assume this is just an extension of the actual bacnet ontology?

I only managed to find what it seems to be the [2012 version of the bacnet ontology](https://[bacowl.sourceforge.net/2012/bacnet.ttl](https://bacowl.sourceforge.net/2012/bacnet.ttl) at https://bacowl.sourceforge.net/.

Could you please provide a hint on how are you integrating with bacnet? Thank you in advance.

JoelBender commented 5 months ago

Do not use that project! I learned a great deal about OWL and some of its complexity, but couldn't get any existing validation tools to work. I have a new RDF model that has been presented to the BACnet Data Modeling Working Group (DM-WG) that is in parallel with the BACnet/XML (a.k.a. CSML) annex and it includes SHACL rules for validation. When the Semantic Interoperability Working Group (SI-WG) gets a round of feedback from the upcoming public review and some more "eyeballs" on it I hope that it can also be sent out for public review.

The BACpypes3 Python project has an RDF module that provides a layer on top of an RDF graph to read and write BACnet/RDF triples, and there is a discover-objects-rdf.py sample application that "discovers" devices and objects.

arrascue commented 5 months ago

Hi @JoelBender , Thank you for the reply. I am bit confused, though. When you mean do not use that project I guess you mean https://bacowl.sourceforge.net/2012/bacnet.ttl right?

If I take a look at the discover-objects-rdf.py sample application, it uses the namespace http://data.ashrae.org/bacnet/2016#, but there are no http://data.ashrae.org/bacnet/2020# resources as in Brick.

I'm still struggling to understand what is the base ontology used in Brick/master/support/bacnet.ttl.

JoelBender commented 5 months ago

When you mean do not use that project I guess you mean https://bacowl.sourceforge.net/2012/bacnet.ttl right?

Correct.

If I take a look at the discover-objects-rdf.py sample application, it uses the namespace http://data.ashrae.org/bacnet/2016#, but there are no http://data.ashrae.org/bacnet/2020# resources as in Brick.

When I started this effort the 2016 edition was the latest comprehensive version (all of the addenda merged into one document) so I used that as the namespace for the model. The 2020 edition is current, and there is a 2024 version that is in the publication pipeline now. When that is available I'll update the library and bump the URI to match. Ontology/model versioning is still a bit of a mystical science, when I get a chance I'll get deeper into how Brick and QUDT handle versioning.

I'm still struggling to understand what is the base ontology used in Brick/master/support/bacnet.ttl.

That file is the SHACL rules for validating a specific RDF serialization of the BACnet device/object/property model. When translating from the BACnet "information model" to anything (binary, XML, JSON, RDF) there are a series of design tradeoffs that have to be made and these are embedded in the rules, but the justification isn't always clear. For example, BACnet has an Object Identifier concept which is serialized as a 32-bit unsigned packed integer in the binary representation and as a character string in others:

        [ a sh:PropertyShape ;
            sh:datatype xsd:string ;
            sh:maxCount 1 ;
            sh:minCount 1 ;
            sh:path bacnet:object-identifier ;
            sh:pattern "^[A-Za-z0-9-]+,[1-9][0-9]*$" ],

For a bacnet:AnalogInputObject (Clause 12.2 Analog Input Object Type) to have an Object_Identifier property (Clause 12.2.1) I decided to make bacnet:object-identifier a predicate using the ASN.1 syntax (Clause 21.6 Base Types, BACnetPropertyIdentifier production). The value pattern matches Clause Y.20.1 ObjectIdentifier.

The "base ontology" is the 1500 page BACnet standard, which does not have a formal set theoretic definition in some language like OWL of KIF, but is formally defined and has an additional companion standard 135.1 to make sure everyone that uses BACnet behaves (a.k.a. interoperable).

gtfierro commented 1 week ago

Closing for now -- feel free to repoen if you feel your question is not fully answered!