Geometry relation models and path traversal using concepts from comp-rob2b and ones introduced for use by the SECORO group.
Classes:
-
FrameModel–Model object for a Frame
-
IFrameRelationModel–Base model for a geometric relation between two Frames.
-
IGeomRelationModel–Base model for a geometric relation between two entities.
-
OrientationModel–Model object for an Orientation relation.
-
PoseModel–Model object for a Pose relation.
-
PositionModel–Model object for a Position relation.
Functions:
-
find_acceleration_twist_path–Find the shortest directed AccelerationTwist path.
-
find_orientation_path–Find the shortest directed Orientation path between two frames.
-
find_pose_path–Find the shortest directed Pose path between two frames.
-
find_position_path–Find the shortest directed Position path between two points.
-
find_relation_path–Find the shortest directed path of typed geometry relations.
-
find_velocity_twist_path–Find the shortest directed VelocityTwist path.
-
relation_neighbors–Find adjacent entities connected by typed geometry relations.
FrameModel
FrameModel(frame_id, graph)
Bases: ModelBase
Model object for a Frame
Attributes:
-
origin(URIRef) –URI for origin Point of the Frame
Parameters:
Source code in src/rdf_utils/models/geom_rel.py
61 62 63 64 65 66 67 68 69 | |
IFrameRelationModel
IFrameRelationModel(rel_id, graph)
Bases: IGeomRelationModel
Base model for a geometric relation between two Frames.
Attributes:
-
of_frame(FrameModel) –Frame described by the relation
-
wrt_frame(FrameModel) –reference Frame
Parameters:
-
rel_id(URIRef) –URI of the frame relation in the graph
-
graph(Graph) –RDF graph for loading attributes
Source code in src/rdf_utils/models/geom_rel.py
157 158 159 160 161 | |
IGeomRelationModel
IGeomRelationModel(rel_id, graph)
Bases: ModelBase
Base model for a geometric relation between two entities.
Attributes:
-
of_id(URIRef) –URI of the entity described by the relation
-
wrt_id(URIRef) –URI of the reference entity
Parameters:
-
rel_id(URIRef) –URI of the geometric relation in the graph
-
graph(Graph) –RDF graph for loading attributes
Source code in src/rdf_utils/models/geom_rel.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
OrientationModel
OrientationModel(orn_id, graph)
Bases: IFrameRelationModel
Model object for an Orientation relation.
Attributes:
-
pose_ids(set[URIRef]) –URIs of Pose relations that reference this Orientation
-
coordinate_ids(set[URIRef]) –URIs of coordinates that reference this Orientation
Parameters:
-
orn_id(URIRef) –URI of the Orientation relation in the graph
-
graph(Graph) –RDF graph for loading attributes
Source code in src/rdf_utils/models/geom_rel.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
PoseModel
PoseModel(pose_id, graph)
Bases: IFrameRelationModel
Model object for a Pose relation.
Referenced Position endpoints must match the Pose frame origins, and referenced Orientation endpoints must match the Pose frames.
Attributes:
-
coordinate_ids(set[URIRef]) –URIs of coordinates that reference this Pose
-
position(PositionModel | None) –referenced Position, when the Pose is a PositionReference
-
orientation(OrientationModel | None) –referenced Orientation, when the Pose is an OrientationReference
Parameters:
-
pose_id(URIRef) –URI of the Pose relation in the graph
-
graph(Graph) –RDF graph for loading attributes
Source code in src/rdf_utils/models/geom_rel.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
PositionModel
PositionModel(position_id, graph)
Bases: IGeomRelationModel
Model object for a Position relation.
Attributes:
-
pose_ids(set[URIRef]) –URIs of Pose relations that reference this Position
-
coordinate_ids(set[URIRef]) –URIs of coordinates that reference this Position
Parameters:
-
position_id(URIRef) –URI of the Position relation in the graph
-
graph(Graph) –RDF graph for loading attributes
Source code in src/rdf_utils/models/geom_rel.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
find_acceleration_twist_path
find_acceleration_twist_path(of_complex, wrt_complex, graph)
Find the shortest directed AccelerationTwist path.
The relations' reference-point values do not affect path connectivity
and are intentionally ignored.
Parameters:
-
of_complex(URIRef) –SimplicialComplex at the start of the path
-
wrt_complex(URIRef) –SimplicialComplex at the end of the path
-
graph(Graph) –RDF graph containing the AccelerationTwist relations
Returns:
-
list[URIRef] | None–AccelerationTwist URIRefs in forward order, an empty list for the same
-
list[URIRef] | None–SimplicialComplex, or None when no path exists
Source code in src/rdf_utils/models/geom_rel.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | |
find_orientation_path
find_orientation_path(of_frame, wrt_frame, graph)
Find the shortest directed Orientation path between two frames.
Parameters:
-
of_frame(URIRef) –frame at the start of the path
-
wrt_frame(URIRef) –frame at the end of the path
-
graph(Graph) –RDF graph containing the Orientation relations
Returns:
-
list[OrientationModel] | None–Orientation models in forward order, an empty list for the same frame,
-
list[OrientationModel] | None–or None when no path exists
Source code in src/rdf_utils/models/geom_rel.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
find_pose_path
find_pose_path(of_frame, wrt_frame, graph)
Find the shortest directed Pose path between two frames.
Parameters:
-
of_frame(URIRef) –frame at the start of the path
-
wrt_frame(URIRef) –frame at the end of the path
-
graph(Graph) –RDF graph containing the Pose relations
Returns:
-
list[PoseModel] | None–Pose models in forward order, an empty list for the same frame, or
-
list[PoseModel] | None–None when no path exists
Source code in src/rdf_utils/models/geom_rel.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | |
find_position_path
find_position_path(of_point, wrt_point, graph)
Find the shortest directed Position path between two points.
Parameters:
-
of_point(URIRef) –point at the start of the path
-
wrt_point(URIRef) –point at the end of the path
-
graph(Graph) –RDF graph containing the Position relations
Returns:
-
list[PositionModel] | None–Position models in forward order, an empty list for the same point,
-
list[PositionModel] | None–or None when no path exists
Source code in src/rdf_utils/models/geom_rel.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
find_relation_path
find_relation_path(start_entity, end_entity, rel_type, graph)
Find the shortest directed path of typed geometry relations.
Uses a geometry-specific bidirectional breadth-first search over
relations with one of and one wrt URIRef.
Parameters:
-
start_entity(URIRef) –entity at the start of the path
-
end_entity(URIRef) –entity at the end of the path
-
rel_type(URIRef) –RDF type required for each relation in the path
-
graph(Graph) –RDF graph containing the geometry relations
Returns:
-
list[URIRef] | None–relation URIRefs in forward order, an empty list when both entities
-
list[URIRef] | None–are identical, or None when no path exists
Source code in src/rdf_utils/models/geom_rel.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
find_velocity_twist_path
find_velocity_twist_path(of_complex, wrt_complex, graph)
Find the shortest directed VelocityTwist path.
The relations' reference-point values do not affect path connectivity
and are intentionally ignored.
Parameters:
-
of_complex(URIRef) –SimplicialComplex at the start of the path
-
wrt_complex(URIRef) –SimplicialComplex at the end of the path
-
graph(Graph) –RDF graph containing the VelocityTwist relations
Returns:
-
list[URIRef] | None–VelocityTwist URIRefs in forward order, an empty list for the same
-
list[URIRef] | None–SimplicialComplex, or None when no path exists
Source code in src/rdf_utils/models/geom_rel.py
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
relation_neighbors
relation_neighbors(entity, rel_type, graph, reverse)
Find adjacent entities connected by typed geometry relations.
By default, this finds relations whose of value is entity and
returns their wrt entities. When reverse is true, it instead finds
relations whose wrt value is entity and returns their of
entities.
Parameters:
-
entity(URIRef) –entity whose adjacent relations to find
-
rel_type(URIRef) –RDF type required for each relation
-
graph(Graph) –RDF graph containing the geometry relations
-
reverse(bool) –whether to find incoming relations from
wrttoof
Returns:
Source code in src/rdf_utils/models/geom_rel.py
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |