Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create abstractions for creating common shacl shapes/constraints #116

Closed
TShapinsky opened this issue Aug 8, 2022 · 2 comments · Fixed by #165
Closed

Create abstractions for creating common shacl shapes/constraints #116

TShapinsky opened this issue Aug 8, 2022 · 2 comments · Fixed by #165
Assignees
Labels
enhancement New feature or request

Comments

@TShapinsky
Copy link
Member

TShapinsky commented Aug 8, 2022

Example:

ahu_feeds_vav = ConnectionConstraint(BRICK["AHU"], BRICK["feeds"], BRICK["VAV"])
shape_collection.add_graph(CountConstraint(ahu_feeds_vav, 5))
shape_collection.add_graph(CountConstraint(BRICK["VAV"], 5))
@TShapinsky TShapinsky added the enhancement New feature or request label Aug 29, 2022
@TShapinsky TShapinsky added this to the Alpha 0.2.0 milestone Aug 29, 2022
@MatthewSteen MatthewSteen removed this from the FY23 Beta Release Candidate milestone Oct 26, 2022
@TShapinsky
Copy link
Member Author

@MatthewSteen @gtfierro @haneslinger Thoughts?

# Using generic rdf shape builder
vav_shape = ShapeBuilder('simple_vav')
  .of_class(BRICK['VAV'])
  .has_relationship(BRICK['isFedBy'],target_class=BRICK['AHU'], count=1)
  .has_relationship(BRICK['feeds'],target_class=BRICK['Zone'], min=1)
  .has_relationship(BRICK['hasPoint'],target_class=BRICK['Zone_Temperature_Sensor'], count=1)
  .make()
  
ahu_shape = ShapeBuilder('simple_ahu')
  .of_class(BRICK['AHU'])
  .count(5)
  .has_relationship(BRICK['feeds'],target_shape=vav_shape, count=5)
  .has_relationship(BRICK['hasPoint'], target_class=BRICK['Outdoor_Air_Temperature_Sensor'], count=1)
  .has_relationship(BRICK['hasPoint'], target_class=BRICK['Return_Air_Temperature_Sensor'], count=1)
  .make()
  
manifest = vav_shape + ahu_shape

# ShapeBuilder extended for Brick specifically
vav_shape = BrickShapeBuilder('simple_vav')
  .of_class(BRICK['VAV'])
  .is_fed_by(BRICK['AHU'])
  .feeds(BRICK['Zone'], min=1)
  .has_points([BRICK['Zone_Temperature_Sensor'], BRICK['Zone_Temperature_Setpoint']], count=1)
  .make()
  
ahu_shape = BrickShapeBuilder('simple_ahu')
  .of_class(BRICK['AHU'])
  .count(5) # Should be 5 in the model
  .feeds(vav_shape, count=5)
  .has_points([BRICK['Outdoor_Air_Temperature_Sensor'],BRICK['Return_Air_Temperature_Sensor']], count=1)
  .make()
         
manifest = vav_shape + ahu_shape

@TShapinsky TShapinsky self-assigned this Nov 3, 2022
@MatthewSteen
Copy link
Member

I like the concept and think it would be a helpful feature. How would the error checking work for all the possibilities of arguments for the different ontologies of 223, Brick, Haystack? Some of this seems reminiscent of https://github.com/gtfierro/oomason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants