shaclapi.reduction.travshacl.ReducedShapeParser module#
- class shaclapi.reduction.travshacl.ReducedShapeParser.ReducedShapeParser(query, graph_traversal, config)[source]#
Bases:
ShapeParser
- parse_shapes(path, shapeFormat, useSelectiveQueries, maxSplitSize, ORDERBYinQueries)[source]#
Parses shapes from a directory or RDFlib graph. However, shapes are only relevant if they occur in the query or are reachable from shapes occurring in the query. The remaining shapes can be removed.
- parse_constraints(array, targetDef, constraintsId)[source]#
Parses all constraints of a shape.
- Parameters:
array – list of constraints belonging to the shape
target_def – the target definition of the shape
constraints_id – suffix for the constraint IDs
- Returns:
list of constraints in internal constraint representation
- parse_constraints_ttl(array, target_def, constraints_id)[source]#
Parses all constraints of a shape.
- Parameters:
array – list of constraints belonging to the shape
target_def – the target definition of the shape
constraints_id – suffix for the constraint IDs
- Returns:
list of constraints in internal constraint representation
- parse_constraint(varGenerator, obj, id, targetDef, options=None)[source]#
- Constraints are only relevant if:
subject and object do both NOT belong to the targetShape OR
subject or object belong to the targetShape AND the predicate is part of the query (-> inverted paths can be treated equally to normal paths)
Other constraints are not relevant and result in an empty list.
- shape_references(constraints)[source]#
Constraints and references are parsed independently based on the input SHACL shape schema. Constraints that are removed in parse_constraint() should not appear in the references. self.removed_constraints keeps track of the removed constraints
shape_references is used to get the references in self.currentShape to other shapes. It then returns ONE path of a constraint referencing to that shape (The other ones are ignored?!)