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

Type ConstraintComponent.constraint_parameters #262

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyshacl/constraints/advanced/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import typing
from typing import Dict, List

from rdflib import Literal
from rdflib import Literal, URIRef

from pyshacl.constraints.constraint_component import ConstraintComponent
from pyshacl.consts import SH, SH_message
Expand Down Expand Up @@ -35,7 +35,7 @@ def __init__(self, shape: 'Shape'):
)

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_expression]

@classmethod
Expand Down
2 changes: 1 addition & 1 deletion pyshacl/constraints/constraint_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, shape: 'Shape'):

@classmethod
@abc.abstractmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
raise NotImplementedError() # pragma: no cover

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions pyshacl/constraints/core/cardinality_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Dict, List, Optional

from rdflib.namespace import XSD
from rdflib.term import Literal
from rdflib.term import Literal, URIRef

from pyshacl.constraints.constraint_component import ConstraintComponent
from pyshacl.consts import SH
Expand Down Expand Up @@ -66,7 +66,7 @@ def __init__(self, shape, min_count_objects: Optional[List[RDFNode]] = None):
)

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_minCount]

@classmethod
Expand Down Expand Up @@ -153,7 +153,7 @@ def __init__(self, shape, max_count_objects: Optional[List[RDFNode]] = None):
)

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_maxCount]

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions pyshacl/constraints/core/logical_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, shape):
self.not_list = not_list

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_not]

@classmethod
Expand Down Expand Up @@ -151,7 +151,7 @@ def __init__(self, shape):
self.and_list = and_list

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_and]

@classmethod
Expand Down Expand Up @@ -247,7 +247,7 @@ def __init__(self, shape):
self.or_list = or_list

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_or]

@classmethod
Expand Down Expand Up @@ -343,7 +343,7 @@ def __init__(self, shape):
self.xone_nodes = xone_nodes

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_xone]

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions pyshacl/constraints/core/other_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, shape):
self.in_vals = in_vals

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_in]

@classmethod
Expand Down Expand Up @@ -133,7 +133,7 @@ def __init__(self, shape):
self.property_shapes = list(self.shape.objects(SH_property))

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_closed, SH_ignoredProperties]

@classmethod
Expand Down Expand Up @@ -280,7 +280,7 @@ def __init__(self, shape):
self.has_value_set = has_value_set

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_hasValue]

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions pyshacl/constraints/core/property_pair_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, shape):
self.property_compare_set = property_compare_set

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_equals]

@classmethod
Expand Down Expand Up @@ -173,7 +173,7 @@ def __init__(self, shape):
self.property_compare_set = property_compare_set

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_disjoint]

@classmethod
Expand Down Expand Up @@ -298,7 +298,7 @@ def __init__(self, shape):
self.property_compare_set = property_compare_set

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_lessThan]

@classmethod
Expand Down Expand Up @@ -449,7 +449,7 @@ def __init__(self, shape):
self.property_compare_set = property_compare_set

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_lessThanOrEquals]

@classmethod
Expand Down
6 changes: 3 additions & 3 deletions pyshacl/constraints/core/shape_based_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, shape):
self.property_shapes = property_shapes

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_property]

@classmethod
Expand Down Expand Up @@ -155,7 +155,7 @@ def __init__(self, shape):
self.node_shapes = node_shapes

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_node]

@classmethod
Expand Down Expand Up @@ -316,7 +316,7 @@ def __init__(self, shape):
self.is_disjoint = is_disjoint

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_qualifiedValueShape, SH_qualifiedMinCount, SH_qualifiedValueShapesDisjoint, SH_qualifiedMaxCount]

@classmethod
Expand Down
12 changes: 6 additions & 6 deletions pyshacl/constraints/core/string_based_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, shape):
self.allow_multi_rules = True

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
raise NotImplementedError()

@classmethod
Expand Down Expand Up @@ -132,7 +132,7 @@ def __init__(self, shape):
self.string_rules = patterns_found

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_minLength]

@classmethod
Expand Down Expand Up @@ -212,7 +212,7 @@ def __init__(self, shape):
self.string_rules = patterns_found

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_maxLength]

@classmethod
Expand Down Expand Up @@ -280,7 +280,7 @@ def __init__(self, shape):
self.flags = None

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_pattern]

@classmethod
Expand Down Expand Up @@ -358,7 +358,7 @@ def __init__(self, shape):
self.string_rules = language_ins_found

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_languageIn]

@classmethod
Expand Down Expand Up @@ -452,7 +452,7 @@ def __init__(self, shape):
self.string_rules = {is_unique_lang.value}

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_uniqueLang]

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions pyshacl/constraints/core/value_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import rdflib
from rdflib.namespace import XSD
from rdflib.term import Literal
from rdflib.term import Literal, URIRef

from pyshacl.constraints.constraint_component import ConstraintComponent
from pyshacl.consts import (
Expand Down Expand Up @@ -70,7 +70,7 @@ def __init__(self, shape):
self.class_rules = class_rules

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_class]

@classmethod
Expand Down Expand Up @@ -184,7 +184,7 @@ def __init__(self, shape):
self.datatype_rule = datatype_rules[0]

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_datatype]

@classmethod
Expand Down Expand Up @@ -292,7 +292,7 @@ def __init__(self, shape):
self.nodekind_rule = nodekind_rules[0]

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_nodeKind]

@classmethod
Expand Down
8 changes: 4 additions & 4 deletions pyshacl/constraints/core/value_range_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, shape):
self.min_vals = min_vals

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_minExclusive]

@classmethod
Expand Down Expand Up @@ -135,7 +135,7 @@ def __init__(self, shape):
self.min_vals = min_vals

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_minInclusive]

@classmethod
Expand Down Expand Up @@ -225,7 +225,7 @@ def __init__(self, shape):
self.max_vals = max_vals

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_maxExclusive]

@classmethod
Expand Down Expand Up @@ -315,7 +315,7 @@ def __init__(self, shape):
self.max_vals = max_vals

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
return [SH_maxInclusive]

@classmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, constraint, shape: 'Shape', validator):
self.query_helper.collect_prefixes()

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[rdflib.URIRef]:
# TODO:coverage: this is never used for this constraint?
return []

Expand Down
3 changes: 2 additions & 1 deletion pyshacl/constraints/sparql/sparql_based_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Dict, List

import rdflib
from rdflib import URIRef

from pyshacl.constraints.constraint_component import ConstraintComponent
from pyshacl.consts import SH, SH_deactivated, SH_message, SH_select
Expand Down Expand Up @@ -81,7 +82,7 @@ def __init__(self, shape):
self.sparql_constraints = sparql_constraints

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_sparql]

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions pyshacl/extras/js/constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import typing
from typing import Dict, List

from rdflib import Literal
from rdflib import Literal, URIRef

from pyshacl.constraints import ConstraintComponent
from pyshacl.consts import SH, SH_js, SH_message
Expand Down Expand Up @@ -70,7 +70,7 @@ def __init__(self, shape: 'Shape'):
self.js_impls = [JSConstraintImpl(shape.sg, j) for j in js_decls]

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return [SH_js]

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions pyshacl/extras/js/constraint_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import typing
from typing import Any, Dict, List, Tuple, Union

from rdflib import Literal
from rdflib import Literal, URIRef

from pyshacl.constraints import ConstraintComponent
from pyshacl.constraints.constraint_component import CustomConstraintComponent
Expand Down Expand Up @@ -65,7 +65,7 @@ def bind_params(self):
self.param_bind_map = bind_map

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
# TODO:coverage: this is never used for this constraint?
return []

Expand Down
2 changes: 1 addition & 1 deletion pyshacl/extras/js/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, target_type: 'JSTargetType', target_declaration, shape: 'Shap
self.params_kv = params_kv # type: dict

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return []

@classmethod
Expand Down
4 changes: 3 additions & 1 deletion pyshacl/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from typing import List, Sequence, Type, Union
from warnings import warn

from rdflib import URIRef

from .constraints import ConstraintComponent
from .consts import SH, RDF_type, RDFS_subClassOf, SH_parameter, SH_select, SH_SPARQLTargetType
from .errors import ConstraintLoadError, ShapeLoadError
Expand Down Expand Up @@ -105,7 +107,7 @@ def __init__(self, target_type, target_declaration, shape, param_vals=None):
self.param_vals = param_vals

@classmethod
def constraint_parameters(cls):
def constraint_parameters(cls) -> List[URIRef]:
return []

@classmethod
Expand Down