Skip to content

Commit 8f944cb

Browse files
Merge branch 'develop'
2 parents 151e0df + 0b25591 commit 8f944cb

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ sheXer includes a package to deploy a web service exposing sheXer with a REST AP
7171

7272
* **Extraction of shapes for federation**. You can configure sheXer to extract information form several endpoints whose URIs are connected. sheXer will extract shapes combining information of both ends which can be helpful for making federated queries.
7373

74+
* **Machine-readable annotations**. frequencies, examples, instance counts, and, in general, any extra information otu or mere shapes and constraints, can be provided in machine-readable RDF annotations.
75+
7476

7577
## Experimental results
7678

@@ -229,6 +231,11 @@ Again, all these params have a default value and you don't need to worry about t
229231
* instances_report_mode (default, const.RATIO_INSTANCES). With this parameter, you can configure how is the information about instances complying to each expression shown. By default, sheXer shows a percetage of instances. If you set this parameter to const.ABSOLUTE_INSTANCES, then the comments will contain the exact number of complying instances instead of the ratio. sheXer will write a comment next to the shape label so you can also know how many instances were used to extract a shape. If you set the parameter to const.MIXED_INSTANCES, the comments will contain both relative and absolute information.
230232
* decimals (default: -1). With this parameter you can configure the number of decimals to be used when writing ratios in comments. A negative numnber means that ratios will be written using its top precision. If you set this parameter to a natural number (including 0), then such number will be the number of decimals used. sheXer will round (not truncate) the original ratio to that precision.
231233
* examples_mode (default: None). You can set this parameter to one of the values included in the '#EXAMPLES' section of shexer.consts. If you choose SHAPE_EXAMPLES, sheXer will write the URI of an instance matching each shape extracted as a comment next to the shape label. If you choose CONSTRAINT_EXAMPLES, sheXer will write a comment including an example of node constraint matching each triple constraint of each shape (each value is used by an instance example with the triple constraint's property). If you choose ALL_EXAMPLES, sheXer will do both things. When the value of this parameter is None, sheXer will not serialize examples in comments.
234+
* generate_annotations (default: False). When set to true, information related to statistics, examples or extra annotations will be provided in machine-readable RDF instead of inline comments.
235+
* example_conformance_prop: Set this parameter to the URI you want to use as property to express the relation between a shape/constraint and a conforming node found in the input.
236+
* absolute_counts_prop: Set this parameter to the URI you want to use as property to express the number of conforming elements with a certain shape/constraint.
237+
* extra_info_prop: Set this parameter to the URI you want to use as property to express extra statistical comments associated to extracted constraints.
238+
* frequency_prop: Set this parameter to the URI you want to use as property to express the usage ratio of a certain property among the explored instances.
232239

233240

234241
### Method __shex\_graph__

shexer/shaper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,9 @@ def _build_shapes_serializer(self, target_file, string_return, output_format, rd
397397
shape_map_raw=self._shape_map_raw,
398398
instance_tracker=self._instance_tracker,
399399
verbose=verbose,
400-
example_constraint_prop=self._example_conformance_prop,
400+
example_conformance_prop=self._example_conformance_prop,
401401
absolute_counts_prop=self._absolute_counts_prop,
402-
comments_to_annotations=self._comments_to_annotations,
402+
generate_annotations=self._comments_to_annotations,
403403
extra_info_prop=self._extra_info_property,
404404
frequency_prop=self._frequency_property)
405405

shexer/utils/factories/shape_serializer_factory.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88

99
def get_shape_serializer(output_format, shapes_list, instance_tracker, target_file=None, string_return=False,
10-
namespaces_dict=None,instantiation_property=None, disable_comments=False,
10+
namespaces_dict=None, instantiation_property=None, disable_comments=False,
1111
wikidata_annotation=False, instances_report_mode=RATIO_INSTANCES, detect_minimal_iri=False,
1212
shape_features_examples=None, examples_mode=None, inverse_paths=False,
1313
rdfconfig_directory=None, endpoint_url=None, shape_map_raw=None, shape_map_file=None,
14-
verbose=False, example_constraint_prop=EXAMPLE_CONFORMANCE_PROP, comments_to_annotations=False,
14+
verbose=False, example_conformance_prop=EXAMPLE_CONFORMANCE_PROP, generate_annotations=False,
1515
absolute_counts_prop=ABSOLUTE_COUNT_PROP, extra_info_prop=EXTRA_INFO_PROP,
1616
frequency_prop=FREQ_PROP):
1717

@@ -37,8 +37,8 @@ def get_shape_serializer(output_format, shapes_list, instance_tracker, target_fi
3737
shape_example_features=shape_features_examples,
3838
examples_mode=examples_mode,
3939
inverse_paths=inverse_paths,
40-
example_constraint_prop=example_constraint_prop,
41-
comments_to_annotations=comments_to_annotations,
40+
example_constraint_prop=example_conformance_prop,
41+
comments_to_annotations=generate_annotations,
4242
absolute_counts_prop=absolute_counts_prop)
4343
elif output_format == SHACL_TURTLE:
4444
return ShaclSerializer(target_file=target_file,
@@ -53,11 +53,11 @@ def get_shape_serializer(output_format, shapes_list, instance_tracker, target_fi
5353
shape_map=None if (shape_map_file is None and shape_map_raw is None)
5454
else instance_tracker.shape_map,
5555
examples_mode=examples_mode,
56-
comments_to_annotations=comments_to_annotations,
56+
comments_to_annotations=generate_annotations,
5757
absolute_counts_prop=absolute_counts_prop,
5858
extra_info_prop=extra_info_prop,
5959
frequency_prop=frequency_prop,
60-
example_constraint_prop=example_constraint_prop,
60+
example_constraint_prop=example_conformance_prop,
6161
instances_report_mode=instances_report_mode)
6262

6363
# example_constraint_prop = EXAMPLE_CONFORMANCE_PROP, comments_to_annotations = True,

0 commit comments

Comments
 (0)