shaclapi.reduction.s2spy.ReducedShapeParser module#
- class shaclapi.reduction.s2spy.ReducedShapeParser.ReducedShapeParser(query, graph_traversal, config)[source]#
Bases:
ShapeParser
- parseShapesFromDir(path, shapeFormat, useSelectiveQueries, maxSplitSize, ORDERBYinQueries)[source]#
Parses shapes from a directory. 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.
- parseConstraint(varGenerator, obj, id, targetDef)[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.
- shapeReferences(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?!)