@shaclmate/shacl-ast 4.0.12 → 4.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/generated.js CHANGED
@@ -237,8 +237,8 @@ export var PropertyShape;
237
237
  !$filterArray($filterIri)(filter.classes, value.classes)) {
238
238
  return false;
239
239
  }
240
- if (filter.comments !== undefined &&
241
- !$filterArray($filterString)(filter.comments, value.comments)) {
240
+ if (filter.comment !== undefined &&
241
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
242
242
  return false;
243
243
  }
244
244
  if (filter.datatype !== undefined &&
@@ -253,8 +253,8 @@ export var PropertyShape;
253
253
  !$filterMaybe($filterTerm)(filter.defaultValue, value.defaultValue)) {
254
254
  return false;
255
255
  }
256
- if (filter.descriptions !== undefined &&
257
- !$filterArray($filterString)(filter.descriptions, value.descriptions)) {
256
+ if (filter.description !== undefined &&
257
+ !$filterMaybe($filterString)(filter.description, value.description)) {
258
258
  return false;
259
259
  }
260
260
  if (filter.flags !== undefined &&
@@ -277,8 +277,8 @@ export var PropertyShape;
277
277
  !$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
278
278
  return false;
279
279
  }
280
- if (filter.labels !== undefined &&
281
- !$filterArray($filterString)(filter.labels, value.labels)) {
280
+ if (filter.label !== undefined &&
281
+ !$filterMaybe($filterString)(filter.label, value.label)) {
282
282
  return false;
283
283
  }
284
284
  if (filter.languageIn !== undefined &&
@@ -317,8 +317,8 @@ export var PropertyShape;
317
317
  !$filterMaybe(($filterNumeric))(filter.minLength, value.minLength)) {
318
318
  return false;
319
319
  }
320
- if (filter.names !== undefined &&
321
- !$filterArray($filterString)(filter.names, value.names)) {
320
+ if (filter.name !== undefined &&
321
+ !$filterMaybe($filterString)(filter.name, value.name)) {
322
322
  return false;
323
323
  }
324
324
  if (filter.nodeKind !== undefined &&
@@ -446,17 +446,18 @@ export var PropertyShape;
446
446
  }).chain((classes) => $shaclPropertyFromRdf({
447
447
  graph: _$options.graph,
448
448
  resource: $resource,
449
- propertySchema: PropertyShape.$schema.properties.comments,
449
+ propertySchema: PropertyShape.$schema.properties.comment,
450
450
  typeFromRdf: (resourceValues) => resourceValues
451
451
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
452
452
  .chain((values) => values.chainMap((value) => value.toString()))
453
- .map((values) => values.toArray())
454
- .map((valuesArray) => Resource.Values.fromValue({
455
- focusResource: $resource,
456
- propertyPath: PropertyShape.$schema.properties.comments.path,
457
- value: valuesArray,
458
- })),
459
- }).chain((comments) => $shaclPropertyFromRdf({
453
+ .map((values) => values.length > 0
454
+ ? values.map((value) => Maybe.of(value))
455
+ : Resource.Values.fromValue({
456
+ focusResource: $resource,
457
+ propertyPath: PropertyShape.$schema.properties.comment.path,
458
+ value: Maybe.empty(),
459
+ })),
460
+ }).chain((comment) => $shaclPropertyFromRdf({
460
461
  graph: _$options.graph,
461
462
  resource: $resource,
462
463
  propertySchema: PropertyShape.$schema.properties.datatype,
@@ -515,18 +516,19 @@ export var PropertyShape;
515
516
  }).chain((defaultValue) => $shaclPropertyFromRdf({
516
517
  graph: _$options.graph,
517
518
  resource: $resource,
518
- propertySchema: PropertyShape.$schema.properties.descriptions,
519
+ propertySchema: PropertyShape.$schema.properties.description,
519
520
  typeFromRdf: (resourceValues) => resourceValues
520
521
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
521
522
  .chain((values) => values.chainMap((value) => value.toString()))
522
- .map((values) => values.toArray())
523
- .map((valuesArray) => Resource.Values.fromValue({
524
- focusResource: $resource,
525
- propertyPath: PropertyShape.$schema.properties
526
- .descriptions.path,
527
- value: valuesArray,
528
- })),
529
- }).chain((descriptions) => $shaclPropertyFromRdf({
523
+ .map((values) => values.length > 0
524
+ ? values.map((value) => Maybe.of(value))
525
+ : Resource.Values.fromValue({
526
+ focusResource: $resource,
527
+ propertyPath: PropertyShape.$schema.properties
528
+ .description.path,
529
+ value: Maybe.empty(),
530
+ })),
531
+ }).chain((description) => $shaclPropertyFromRdf({
530
532
  graph: _$options.graph,
531
533
  resource: $resource,
532
534
  propertySchema: PropertyShape.$schema.properties.flags,
@@ -638,18 +640,19 @@ export var PropertyShape;
638
640
  }).chain((isDefinedBy) => $shaclPropertyFromRdf({
639
641
  graph: _$options.graph,
640
642
  resource: $resource,
641
- propertySchema: PropertyShape.$schema.properties.labels,
643
+ propertySchema: PropertyShape.$schema.properties.label,
642
644
  typeFromRdf: (resourceValues) => resourceValues
643
645
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
644
646
  .chain((values) => values.chainMap((value) => value.toString()))
645
- .map((values) => values.toArray())
646
- .map((valuesArray) => Resource.Values.fromValue({
647
- focusResource: $resource,
648
- propertyPath: PropertyShape.$schema.properties
649
- .labels.path,
650
- value: valuesArray,
651
- })),
652
- }).chain((labels) => $shaclPropertyFromRdf({
647
+ .map((values) => values.length > 0
648
+ ? values.map((value) => Maybe.of(value))
649
+ : Resource.Values.fromValue({
650
+ focusResource: $resource,
651
+ propertyPath: PropertyShape.$schema
652
+ .properties.label.path,
653
+ value: Maybe.empty(),
654
+ })),
655
+ }).chain((label) => $shaclPropertyFromRdf({
653
656
  graph: _$options.graph,
654
657
  resource: $resource,
655
658
  propertySchema: PropertyShape.$schema.properties.languageIn,
@@ -818,21 +821,23 @@ export var PropertyShape;
818
821
  graph: _$options.graph,
819
822
  resource: $resource,
820
823
  propertySchema: PropertyShape.$schema.properties
821
- .names,
824
+ .name,
822
825
  typeFromRdf: (resourceValues) => resourceValues
823
826
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
824
827
  .chain((values) => values.chainMap((value) => value.toString()))
825
- .map((values) => values.toArray())
826
- .map((valuesArray) => Resource.Values.fromValue({
827
- focusResource: $resource,
828
- propertyPath: PropertyShape
829
- .$schema
830
- .properties
831
- .names
832
- .path,
833
- value: valuesArray,
834
- })),
835
- }).chain((names) => $shaclPropertyFromRdf({
828
+ .map((values) => values.length >
829
+ 0
830
+ ? values.map((value) => Maybe.of(value))
831
+ : Resource.Values.fromValue({
832
+ focusResource: $resource,
833
+ propertyPath: PropertyShape
834
+ .$schema
835
+ .properties
836
+ .name
837
+ .path,
838
+ value: Maybe.empty(),
839
+ })),
840
+ }).chain((name) => $shaclPropertyFromRdf({
836
841
  graph: _$options.graph,
837
842
  resource: $resource,
838
843
  propertySchema: PropertyShape.$schema
@@ -1038,17 +1043,17 @@ export var PropertyShape;
1038
1043
  $type,
1039
1044
  and,
1040
1045
  classes,
1041
- comments,
1046
+ comment,
1042
1047
  datatype,
1043
1048
  deactivated,
1044
1049
  defaultValue,
1045
- descriptions,
1050
+ description,
1046
1051
  flags,
1047
1052
  groups,
1048
1053
  hasValues,
1049
1054
  in_,
1050
1055
  isDefinedBy,
1051
- labels,
1056
+ label,
1052
1057
  languageIn,
1053
1058
  maxCount,
1054
1059
  maxExclusive,
@@ -1058,7 +1063,7 @@ export var PropertyShape;
1058
1063
  minExclusive,
1059
1064
  minInclusive,
1060
1065
  minLength,
1061
- names,
1066
+ name,
1062
1067
  nodeKind,
1063
1068
  nodes,
1064
1069
  not,
@@ -1102,10 +1107,10 @@ export var PropertyShape;
1102
1107
  }),
1103
1108
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
1104
1109
  },
1105
- comments: {
1110
+ comment: {
1106
1111
  kind: "Shacl",
1107
1112
  type: () => ({
1108
- kind: "Set",
1113
+ kind: "Maybe",
1109
1114
  item: () => ({ kind: "String" }),
1110
1115
  }),
1111
1116
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -1134,10 +1139,10 @@ export var PropertyShape;
1134
1139
  }),
1135
1140
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"),
1136
1141
  },
1137
- descriptions: {
1142
+ description: {
1138
1143
  kind: "Shacl",
1139
1144
  type: () => ({
1140
- kind: "Set",
1145
+ kind: "Maybe",
1141
1146
  item: () => ({ kind: "String" }),
1142
1147
  }),
1143
1148
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#description"),
@@ -1185,10 +1190,10 @@ export var PropertyShape;
1185
1190
  }),
1186
1191
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
1187
1192
  },
1188
- labels: {
1193
+ label: {
1189
1194
  kind: "Shacl",
1190
1195
  type: () => ({
1191
- kind: "Set",
1196
+ kind: "Maybe",
1192
1197
  item: () => ({ kind: "String" }),
1193
1198
  }),
1194
1199
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -1268,10 +1273,10 @@ export var PropertyShape;
1268
1273
  }),
1269
1274
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#minLength"),
1270
1275
  },
1271
- names: {
1276
+ name: {
1272
1277
  kind: "Shacl",
1273
1278
  type: () => ({
1274
- kind: "Set",
1279
+ kind: "Maybe",
1275
1280
  item: () => ({ kind: "String" }),
1276
1281
  }),
1277
1282
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#name"),
@@ -1393,7 +1398,9 @@ export var PropertyShape;
1393
1398
  : $RdfVocabularies.rdf.nil,
1394
1399
  ]), options?.graph);
1395
1400
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#class"), _propertyShape.classes.flatMap((item) => [item]), options?.graph);
1396
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyShape.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1401
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyShape.comment
1402
+ .toList()
1403
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1397
1404
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _propertyShape.datatype.toList(), options?.graph);
1398
1405
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _propertyShape.deactivated
1399
1406
  .toList()
@@ -1401,9 +1408,9 @@ export var PropertyShape;
1401
1408
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
1402
1409
  ]), options?.graph);
1403
1410
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#defaultValue"), _propertyShape.defaultValue.toList(), options?.graph);
1404
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _propertyShape.descriptions.flatMap((item) => [
1405
- $literalFactory.string(item),
1406
- ]), options?.graph);
1411
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#description"), _propertyShape.description
1412
+ .toList()
1413
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1407
1414
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#flags"), _propertyShape.flags.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1408
1415
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#group"), _propertyShape.groups.flatMap((item) => [item]), options?.graph);
1409
1416
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#hasValue"), _propertyShape.hasValues.flatMap((item) => [item]), options?.graph);
@@ -1430,7 +1437,9 @@ export var PropertyShape;
1430
1437
  : $RdfVocabularies.rdf.nil,
1431
1438
  ]), options?.graph);
1432
1439
  resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _propertyShape.isDefinedBy.toList(), options?.graph);
1433
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyShape.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1440
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyShape.label
1441
+ .toList()
1442
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1434
1443
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _propertyShape.languageIn.toList().flatMap((value) => [
1435
1444
  value.length > 0
1436
1445
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
@@ -1477,7 +1486,9 @@ export var PropertyShape;
1477
1486
  .flatMap((value) => [
1478
1487
  $literalFactory.number(value, $RdfVocabularies.xsd.unsignedInt),
1479
1488
  ]), options?.graph);
1480
- resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _propertyShape.names.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1489
+ resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#name"), _propertyShape.name
1490
+ .toList()
1491
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1481
1492
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#nodeKind"), _propertyShape.nodeKind.toList(), options?.graph);
1482
1493
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#node"), _propertyShape.nodes.flatMap((item) => [item]), options?.graph);
1483
1494
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#not"), _propertyShape.not.flatMap((item) => [item]), options?.graph);
@@ -1558,12 +1569,12 @@ export var PropertyGroup;
1558
1569
  !$filterIdentifier(filter.$identifier, value.$identifier)) {
1559
1570
  return false;
1560
1571
  }
1561
- if (filter.comments !== undefined &&
1562
- !$filterArray($filterString)(filter.comments, value.comments)) {
1572
+ if (filter.comment !== undefined &&
1573
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
1563
1574
  return false;
1564
1575
  }
1565
- if (filter.labels !== undefined &&
1566
- !$filterArray($filterString)(filter.labels, value.labels)) {
1576
+ if (filter.label !== undefined &&
1577
+ !$filterMaybe($filterString)(filter.label, value.label)) {
1567
1578
  return false;
1568
1579
  }
1569
1580
  return true;
@@ -1625,30 +1636,32 @@ export var PropertyGroup;
1625
1636
  .chain(($identifier) => Right("PropertyGroup").chain(($type) => $shaclPropertyFromRdf({
1626
1637
  graph: _$options.graph,
1627
1638
  resource: $resource,
1628
- propertySchema: PropertyGroup.$schema.properties.comments,
1639
+ propertySchema: PropertyGroup.$schema.properties.comment,
1629
1640
  typeFromRdf: (resourceValues) => resourceValues
1630
1641
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1631
1642
  .chain((values) => values.chainMap((value) => value.toString()))
1632
- .map((values) => values.toArray())
1633
- .map((valuesArray) => Resource.Values.fromValue({
1634
- focusResource: $resource,
1635
- propertyPath: PropertyGroup.$schema.properties.comments.path,
1636
- value: valuesArray,
1637
- })),
1638
- }).chain((comments) => $shaclPropertyFromRdf({
1643
+ .map((values) => values.length > 0
1644
+ ? values.map((value) => Maybe.of(value))
1645
+ : Resource.Values.fromValue({
1646
+ focusResource: $resource,
1647
+ propertyPath: PropertyShape.$schema.properties.comment.path,
1648
+ value: Maybe.empty(),
1649
+ })),
1650
+ }).chain((comment) => $shaclPropertyFromRdf({
1639
1651
  graph: _$options.graph,
1640
1652
  resource: $resource,
1641
- propertySchema: PropertyGroup.$schema.properties.labels,
1653
+ propertySchema: PropertyGroup.$schema.properties.label,
1642
1654
  typeFromRdf: (resourceValues) => resourceValues
1643
1655
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1644
1656
  .chain((values) => values.chainMap((value) => value.toString()))
1645
- .map((values) => values.toArray())
1646
- .map((valuesArray) => Resource.Values.fromValue({
1647
- focusResource: $resource,
1648
- propertyPath: PropertyGroup.$schema.properties.labels.path,
1649
- value: valuesArray,
1650
- })),
1651
- }).map((labels) => ({ $identifier, $type, comments, labels }))))));
1657
+ .map((values) => values.length > 0
1658
+ ? values.map((value) => Maybe.of(value))
1659
+ : Resource.Values.fromValue({
1660
+ focusResource: $resource,
1661
+ propertyPath: PropertyShape.$schema.properties.label.path,
1662
+ value: Maybe.empty(),
1663
+ })),
1664
+ }).map((label) => ({ $identifier, $type, comment, label }))))));
1652
1665
  };
1653
1666
  PropertyGroup.$schema = {
1654
1667
  properties: {
@@ -1663,18 +1676,18 @@ export var PropertyGroup;
1663
1676
  ownValues: ["PropertyGroup"],
1664
1677
  }),
1665
1678
  },
1666
- comments: {
1679
+ comment: {
1667
1680
  kind: "Shacl",
1668
1681
  type: () => ({
1669
- kind: "Set",
1682
+ kind: "Maybe",
1670
1683
  item: () => ({ kind: "String" }),
1671
1684
  }),
1672
1685
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1673
1686
  },
1674
- labels: {
1687
+ label: {
1675
1688
  kind: "Shacl",
1676
1689
  type: () => ({
1677
- kind: "Set",
1690
+ kind: "Maybe",
1678
1691
  item: () => ({ kind: "String" }),
1679
1692
  }),
1680
1693
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -1688,8 +1701,12 @@ export var PropertyGroup;
1688
1701
  if (!options?.ignoreRdfType) {
1689
1702
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#PropertyGroup"), options?.graph);
1690
1703
  }
1691
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyGroup.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1692
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyGroup.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1704
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _propertyGroup.comment
1705
+ .toList()
1706
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1707
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _propertyGroup.label
1708
+ .toList()
1709
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1693
1710
  return resource;
1694
1711
  }
1695
1712
  PropertyGroup.$toRdfResource = $toRdfResource;
@@ -1706,8 +1723,12 @@ export var Ontology;
1706
1723
  !$filterIdentifier(filter.$identifier, value.$identifier)) {
1707
1724
  return false;
1708
1725
  }
1709
- if (filter.labels !== undefined &&
1710
- !$filterArray($filterString)(filter.labels, value.labels)) {
1726
+ if (filter.comment !== undefined &&
1727
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
1728
+ return false;
1729
+ }
1730
+ if (filter.label !== undefined &&
1731
+ !$filterMaybe($filterString)(filter.label, value.label)) {
1711
1732
  return false;
1712
1733
  }
1713
1734
  return true;
@@ -1769,17 +1790,32 @@ export var Ontology;
1769
1790
  .chain(($identifier) => Right("Ontology").chain(($type) => $shaclPropertyFromRdf({
1770
1791
  graph: _$options.graph,
1771
1792
  resource: $resource,
1772
- propertySchema: Ontology.$schema.properties.labels,
1793
+ propertySchema: Ontology.$schema.properties.comment,
1773
1794
  typeFromRdf: (resourceValues) => resourceValues
1774
1795
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1775
1796
  .chain((values) => values.chainMap((value) => value.toString()))
1776
- .map((values) => values.toArray())
1777
- .map((valuesArray) => Resource.Values.fromValue({
1778
- focusResource: $resource,
1779
- propertyPath: Ontology.$schema.properties.labels.path,
1780
- value: valuesArray,
1781
- })),
1782
- }).map((labels) => ({ $identifier, $type, labels })))));
1797
+ .map((values) => values.length > 0
1798
+ ? values.map((value) => Maybe.of(value))
1799
+ : Resource.Values.fromValue({
1800
+ focusResource: $resource,
1801
+ propertyPath: PropertyShape.$schema.properties.comment.path,
1802
+ value: Maybe.empty(),
1803
+ })),
1804
+ }).chain((comment) => $shaclPropertyFromRdf({
1805
+ graph: _$options.graph,
1806
+ resource: $resource,
1807
+ propertySchema: Ontology.$schema.properties.label,
1808
+ typeFromRdf: (resourceValues) => resourceValues
1809
+ .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
1810
+ .chain((values) => values.chainMap((value) => value.toString()))
1811
+ .map((values) => values.length > 0
1812
+ ? values.map((value) => Maybe.of(value))
1813
+ : Resource.Values.fromValue({
1814
+ focusResource: $resource,
1815
+ propertyPath: PropertyShape.$schema.properties.label.path,
1816
+ value: Maybe.empty(),
1817
+ })),
1818
+ }).map((label) => ({ $identifier, $type, comment, label }))))));
1783
1819
  };
1784
1820
  Ontology.$schema = {
1785
1821
  properties: {
@@ -1794,10 +1830,18 @@ export var Ontology;
1794
1830
  ownValues: ["Ontology"],
1795
1831
  }),
1796
1832
  },
1797
- labels: {
1833
+ comment: {
1798
1834
  kind: "Shacl",
1799
1835
  type: () => ({
1800
- kind: "Set",
1836
+ kind: "Maybe",
1837
+ item: () => ({ kind: "String" }),
1838
+ }),
1839
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
1840
+ },
1841
+ label: {
1842
+ kind: "Shacl",
1843
+ type: () => ({
1844
+ kind: "Maybe",
1801
1845
  item: () => ({ kind: "String" }),
1802
1846
  }),
1803
1847
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -1811,7 +1855,12 @@ export var Ontology;
1811
1855
  if (!options?.ignoreRdfType) {
1812
1856
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/2002/07/owl#Ontology"), options?.graph);
1813
1857
  }
1814
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _ontology.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
1858
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _ontology.comment
1859
+ .toList()
1860
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1861
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _ontology.label
1862
+ .toList()
1863
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
1815
1864
  return resource;
1816
1865
  }
1817
1866
  Ontology.$toRdfResource = $toRdfResource;
@@ -1840,8 +1889,8 @@ export var NodeShape;
1840
1889
  !$filterMaybe($filterBoolean)(filter.closed, value.closed)) {
1841
1890
  return false;
1842
1891
  }
1843
- if (filter.comments !== undefined &&
1844
- !$filterArray($filterString)(filter.comments, value.comments)) {
1892
+ if (filter.comment !== undefined &&
1893
+ !$filterMaybe($filterString)(filter.comment, value.comment)) {
1845
1894
  return false;
1846
1895
  }
1847
1896
  if (filter.datatype !== undefined &&
@@ -1872,8 +1921,8 @@ export var NodeShape;
1872
1921
  !$filterMaybe($filterIdentifier)(filter.isDefinedBy, value.isDefinedBy)) {
1873
1922
  return false;
1874
1923
  }
1875
- if (filter.labels !== undefined &&
1876
- !$filterArray($filterString)(filter.labels, value.labels)) {
1924
+ if (filter.label !== undefined &&
1925
+ !$filterMaybe($filterString)(filter.label, value.label)) {
1877
1926
  return false;
1878
1927
  }
1879
1928
  if (filter.languageIn !== undefined &&
@@ -2042,17 +2091,18 @@ export var NodeShape;
2042
2091
  }).chain((closed) => $shaclPropertyFromRdf({
2043
2092
  graph: _$options.graph,
2044
2093
  resource: $resource,
2045
- propertySchema: NodeShape.$schema.properties.comments,
2094
+ propertySchema: NodeShape.$schema.properties.comment,
2046
2095
  typeFromRdf: (resourceValues) => resourceValues
2047
2096
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2048
2097
  .chain((values) => values.chainMap((value) => value.toString()))
2049
- .map((values) => values.toArray())
2050
- .map((valuesArray) => Resource.Values.fromValue({
2051
- focusResource: $resource,
2052
- propertyPath: PropertyShape.$schema.properties.comments.path,
2053
- value: valuesArray,
2054
- })),
2055
- }).chain((comments) => $shaclPropertyFromRdf({
2098
+ .map((values) => values.length > 0
2099
+ ? values.map((value) => Maybe.of(value))
2100
+ : Resource.Values.fromValue({
2101
+ focusResource: $resource,
2102
+ propertyPath: PropertyShape.$schema.properties.comment.path,
2103
+ value: Maybe.empty(),
2104
+ })),
2105
+ }).chain((comment) => $shaclPropertyFromRdf({
2056
2106
  graph: _$options.graph,
2057
2107
  resource: $resource,
2058
2108
  propertySchema: NodeShape.$schema.properties.datatype,
@@ -2196,18 +2246,19 @@ export var NodeShape;
2196
2246
  }).chain((isDefinedBy) => $shaclPropertyFromRdf({
2197
2247
  graph: _$options.graph,
2198
2248
  resource: $resource,
2199
- propertySchema: NodeShape.$schema.properties.labels,
2249
+ propertySchema: NodeShape.$schema.properties.label,
2200
2250
  typeFromRdf: (resourceValues) => resourceValues
2201
2251
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
2202
2252
  .chain((values) => values.chainMap((value) => value.toString()))
2203
- .map((values) => values.toArray())
2204
- .map((valuesArray) => Resource.Values.fromValue({
2205
- focusResource: $resource,
2206
- propertyPath: PropertyShape.$schema.properties
2207
- .labels.path,
2208
- value: valuesArray,
2209
- })),
2210
- }).chain((labels) => $shaclPropertyFromRdf({
2253
+ .map((values) => values.length > 0
2254
+ ? values.map((value) => Maybe.of(value))
2255
+ : Resource.Values.fromValue({
2256
+ focusResource: $resource,
2257
+ propertyPath: PropertyShape.$schema
2258
+ .properties.label.path,
2259
+ value: Maybe.empty(),
2260
+ })),
2261
+ }).chain((label) => $shaclPropertyFromRdf({
2211
2262
  graph: _$options.graph,
2212
2263
  resource: $resource,
2213
2264
  propertySchema: NodeShape.$schema.properties.languageIn,
@@ -2532,7 +2583,7 @@ export var NodeShape;
2532
2583
  and,
2533
2584
  classes,
2534
2585
  closed,
2535
- comments,
2586
+ comment,
2536
2587
  datatype,
2537
2588
  deactivated,
2538
2589
  flags,
@@ -2540,7 +2591,7 @@ export var NodeShape;
2540
2591
  ignoredProperties,
2541
2592
  in_,
2542
2593
  isDefinedBy,
2543
- labels,
2594
+ label,
2544
2595
  languageIn,
2545
2596
  maxCount,
2546
2597
  maxExclusive,
@@ -2599,10 +2650,10 @@ export var NodeShape;
2599
2650
  }),
2600
2651
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#closed"),
2601
2652
  },
2602
- comments: {
2653
+ comment: {
2603
2654
  kind: "Shacl",
2604
2655
  type: () => ({
2605
- kind: "Set",
2656
+ kind: "Maybe",
2606
2657
  item: () => ({ kind: "String" }),
2607
2658
  }),
2608
2659
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -2669,10 +2720,10 @@ export var NodeShape;
2669
2720
  }),
2670
2721
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
2671
2722
  },
2672
- labels: {
2723
+ label: {
2673
2724
  kind: "Shacl",
2674
2725
  type: () => ({
2675
- kind: "Set",
2726
+ kind: "Maybe",
2676
2727
  item: () => ({ kind: "String" }),
2677
2728
  }),
2678
2729
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -2861,7 +2912,9 @@ export var NodeShape;
2861
2912
  .flatMap((value) => [
2862
2913
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2863
2914
  ]), options?.graph);
2864
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _nodeShape.comments.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2915
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"), _nodeShape.comment
2916
+ .toList()
2917
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2865
2918
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#datatype"), _nodeShape.datatype.toList(), options?.graph);
2866
2919
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#deactivated"), _nodeShape.deactivated
2867
2920
  .toList()
@@ -2915,7 +2968,9 @@ export var NodeShape;
2915
2968
  : $RdfVocabularies.rdf.nil,
2916
2969
  ]), options?.graph);
2917
2970
  resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"), _nodeShape.isDefinedBy.toList(), options?.graph);
2918
- resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _nodeShape.labels.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
2971
+ resource.add(dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"), _nodeShape.label
2972
+ .toList()
2973
+ .flatMap((value) => [$literalFactory.string(value)]), options?.graph);
2919
2974
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#languageIn"), _nodeShape.languageIn.toList().flatMap((value) => [
2920
2975
  value.length > 0
2921
2976
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
@@ -3017,15 +3072,6 @@ export var NodeShape;
3017
3072
  })(NodeShape || (NodeShape = {}));
3018
3073
  export var Shape;
3019
3074
  (function (Shape) {
3020
- Shape.$toRdfResource = (value, options) => {
3021
- if (NodeShape.isNodeShape(value)) {
3022
- return NodeShape.$toRdfResource(value, options);
3023
- }
3024
- if (PropertyShape.isPropertyShape(value)) {
3025
- return PropertyShape.$toRdfResource(value, options);
3026
- }
3027
- throw new Error("unrecognized type");
3028
- };
3029
3075
  Shape.$filter = (filter, value) => {
3030
3076
  if (filter.$identifier !== undefined &&
3031
3077
  !$filterIdentifier(filter.$identifier, value.$identifier)) {
@@ -3108,10 +3154,10 @@ export var Shape;
3108
3154
  }),
3109
3155
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#class"),
3110
3156
  },
3111
- comments: {
3157
+ comment: {
3112
3158
  kind: "Shacl",
3113
3159
  type: () => ({
3114
- kind: "Set",
3160
+ kind: "Maybe",
3115
3161
  item: () => ({ kind: "String" }),
3116
3162
  }),
3117
3163
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
@@ -3167,10 +3213,10 @@ export var Shape;
3167
3213
  }),
3168
3214
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#isDefinedBy"),
3169
3215
  },
3170
- labels: {
3216
+ label: {
3171
3217
  kind: "Shacl",
3172
3218
  type: () => ({
3173
- kind: "Set",
3219
+ kind: "Maybe",
3174
3220
  item: () => ({ kind: "String" }),
3175
3221
  }),
3176
3222
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
@@ -3316,6 +3362,15 @@ export var Shape;
3316
3362
  },
3317
3363
  },
3318
3364
  };
3365
+ Shape.$toRdfResource = (value, options) => {
3366
+ if (NodeShape.isNodeShape(value)) {
3367
+ return NodeShape.$toRdfResource(value, options);
3368
+ }
3369
+ if (PropertyShape.isPropertyShape(value)) {
3370
+ return PropertyShape.$toRdfResource(value, options);
3371
+ }
3372
+ throw new Error("unrecognized type");
3373
+ };
3319
3374
  Shape.$toRdfResourceValues = ((value, _options) => {
3320
3375
  if (NodeShape.isNodeShape(value)) {
3321
3376
  return [
@@ -3342,21 +3397,6 @@ export var Shape;
3342
3397
  })(Shape || (Shape = {}));
3343
3398
  export var $Object;
3344
3399
  (function ($Object) {
3345
- $Object.$toRdfResource = (value, options) => {
3346
- if (NodeShape.isNodeShape(value)) {
3347
- return NodeShape.$toRdfResource(value, options);
3348
- }
3349
- if (Ontology.isOntology(value)) {
3350
- return Ontology.$toRdfResource(value, options);
3351
- }
3352
- if (PropertyGroup.isPropertyGroup(value)) {
3353
- return PropertyGroup.$toRdfResource(value, options);
3354
- }
3355
- if (PropertyShape.isPropertyShape(value)) {
3356
- return PropertyShape.$toRdfResource(value, options);
3357
- }
3358
- throw new Error("unrecognized type");
3359
- };
3360
3400
  $Object.$filter = (filter, value) => {
3361
3401
  if (filter.$identifier !== undefined &&
3362
3402
  !$filterIdentifier(filter.$identifier, value.$identifier)) {
@@ -3463,16 +3503,39 @@ export var $Object;
3463
3503
  },
3464
3504
  },
3465
3505
  properties: {
3466
- labels: {
3506
+ comment: {
3467
3507
  kind: "Shacl",
3468
3508
  type: () => ({
3469
- kind: "Set",
3509
+ kind: "Maybe",
3510
+ item: () => ({ kind: "String" }),
3511
+ }),
3512
+ path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#comment"),
3513
+ },
3514
+ label: {
3515
+ kind: "Shacl",
3516
+ type: () => ({
3517
+ kind: "Maybe",
3470
3518
  item: () => ({ kind: "String" }),
3471
3519
  }),
3472
3520
  path: dataFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#label"),
3473
3521
  },
3474
3522
  },
3475
3523
  };
3524
+ $Object.$toRdfResource = (value, options) => {
3525
+ if (NodeShape.isNodeShape(value)) {
3526
+ return NodeShape.$toRdfResource(value, options);
3527
+ }
3528
+ if (Ontology.isOntology(value)) {
3529
+ return Ontology.$toRdfResource(value, options);
3530
+ }
3531
+ if (PropertyGroup.isPropertyGroup(value)) {
3532
+ return PropertyGroup.$toRdfResource(value, options);
3533
+ }
3534
+ if (PropertyShape.isPropertyShape(value)) {
3535
+ return PropertyShape.$toRdfResource(value, options);
3536
+ }
3537
+ throw new Error("unrecognized type");
3538
+ };
3476
3539
  $Object.$toRdfResourceValues = ((value, _options) => {
3477
3540
  if (NodeShape.isNodeShape(value)) {
3478
3541
  return [
@@ -3735,7 +3798,7 @@ export class $RdfjsDatasetObjectSet {
3735
3798
  },
3736
3799
  ], query);
3737
3800
  }
3738
- $objectsSync(objectType, query) {
3801
+ $objectsSync(namedObjectType, query) {
3739
3802
  const graph = query?.graph ?? this.$graph;
3740
3803
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
3741
3804
  if (limit <= 0) {
@@ -3759,11 +3822,11 @@ export class $RdfjsDatasetObjectSet {
3759
3822
  }));
3760
3823
  sortResources = false;
3761
3824
  }
3762
- else if (objectType.$fromRdfTypes.length > 0) {
3825
+ else if (namedObjectType.$fromRdfTypes.length > 0) {
3763
3826
  const identifierSet = new $IdentifierSet();
3764
3827
  resources = [];
3765
3828
  sortResources = true;
3766
- for (const fromRdfType of objectType.$fromRdfTypes) {
3829
+ for (const fromRdfType of namedObjectType.$fromRdfTypes) {
3767
3830
  for (const resource of resourceSet.instancesOf(fromRdfType, {
3768
3831
  graph,
3769
3832
  })) {
@@ -3795,7 +3858,7 @@ export class $RdfjsDatasetObjectSet {
3795
3858
  identifierSet.add(quad.subject);
3796
3859
  const resource = resourceSet.resource(quad.subject);
3797
3860
  // Eagerly eliminate the majority of resources that won't match the object type
3798
- objectType
3861
+ namedObjectType
3799
3862
  .$fromRdfResource(resource, fromRdfResourceOptions)
3800
3863
  .ifRight((object) => {
3801
3864
  resources.push({ object, resource });
@@ -3810,13 +3873,13 @@ export class $RdfjsDatasetObjectSet {
3810
3873
  const objects = [];
3811
3874
  for (let { object, resource } of resources) {
3812
3875
  if (!object) {
3813
- const objectEither = objectType.$fromRdfResource(resource, fromRdfResourceOptions);
3876
+ const objectEither = namedObjectType.$fromRdfResource(resource, fromRdfResourceOptions);
3814
3877
  if (objectEither.isLeft()) {
3815
3878
  return objectEither;
3816
3879
  }
3817
3880
  object = objectEither.unsafeCoerce();
3818
3881
  }
3819
- if (query?.filter && !objectType.$filter(query.filter, object)) {
3882
+ if (query?.filter && !namedObjectType.$filter(query.filter, object)) {
3820
3883
  continue;
3821
3884
  }
3822
3885
  if (objectI++ >= offset) {
@@ -3828,7 +3891,7 @@ export class $RdfjsDatasetObjectSet {
3828
3891
  }
3829
3892
  return Right(objects);
3830
3893
  }
3831
- $objectUnionsSync(objectTypes, query) {
3894
+ $objectUnionsSync(namedObjectTypes, query) {
3832
3895
  const graph = query?.graph ?? this.$graph;
3833
3896
  const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
3834
3897
  if (limit <= 0) {
@@ -3852,18 +3915,18 @@ export class $RdfjsDatasetObjectSet {
3852
3915
  }));
3853
3916
  sortResources = false;
3854
3917
  }
3855
- else if (objectTypes.every((objectType) => objectType.$fromRdfTypes.length > 0)) {
3918
+ else if (namedObjectTypes.every((namedObjectType) => namedObjectType.$fromRdfTypes.length > 0)) {
3856
3919
  const identifierSet = new $IdentifierSet();
3857
3920
  resources = [];
3858
3921
  sortResources = true;
3859
- for (const objectType of objectTypes) {
3860
- for (const fromRdfType of objectType.$fromRdfTypes) {
3922
+ for (const namedObjectType of namedObjectTypes) {
3923
+ for (const fromRdfType of namedObjectType.$fromRdfTypes) {
3861
3924
  for (const resource of resourceSet.instancesOf(fromRdfType, {
3862
3925
  graph,
3863
3926
  })) {
3864
3927
  if (!identifierSet.has(resource.identifier)) {
3865
3928
  identifierSet.add(resource.identifier);
3866
- resources.push({ objectType, resource });
3929
+ resources.push({ namedObjectType, resource });
3867
3930
  }
3868
3931
  }
3869
3932
  }
@@ -3890,11 +3953,11 @@ export class $RdfjsDatasetObjectSet {
3890
3953
  identifierSet.add(quad.subject);
3891
3954
  // Eagerly eliminate the majority of resources that won't match the object types
3892
3955
  const resource = resourceSet.resource(quad.subject);
3893
- for (const objectType of objectTypes) {
3894
- if (objectType
3956
+ for (const namedObjectType of namedObjectTypes) {
3957
+ if (namedObjectType
3895
3958
  .$fromRdfResource(resource, fromRdfResourceOptions)
3896
3959
  .ifRight((object) => {
3897
- resources.push({ object, objectType, resource });
3960
+ resources.push({ object, namedObjectType, resource });
3898
3961
  })
3899
3962
  .isRight()) {
3900
3963
  break;
@@ -3908,18 +3971,18 @@ export class $RdfjsDatasetObjectSet {
3908
3971
  }
3909
3972
  let objectI = 0;
3910
3973
  const objects = [];
3911
- for (let { object, objectType, resource } of resources) {
3974
+ for (let { object, namedObjectType, resource } of resources) {
3912
3975
  if (!object) {
3913
3976
  let objectEither;
3914
- if (objectType) {
3915
- objectEither = objectType.$fromRdfResource(resource, fromRdfResourceOptions);
3977
+ if (namedObjectType) {
3978
+ objectEither = namedObjectType.$fromRdfResource(resource, fromRdfResourceOptions);
3916
3979
  }
3917
3980
  else {
3918
3981
  objectEither = Left(new Error("no object types"));
3919
- for (const tryObjectType of objectTypes) {
3982
+ for (const tryObjectType of namedObjectTypes) {
3920
3983
  objectEither = tryObjectType.$fromRdfResource(resource, fromRdfResourceOptions);
3921
3984
  if (objectEither.isRight()) {
3922
- objectType = tryObjectType;
3985
+ namedObjectType = tryObjectType;
3923
3986
  break;
3924
3987
  }
3925
3988
  }
@@ -3929,10 +3992,10 @@ export class $RdfjsDatasetObjectSet {
3929
3992
  }
3930
3993
  object = objectEither.unsafeCoerce();
3931
3994
  }
3932
- if (!objectType) {
3933
- throw new Error("objectType should be set here");
3995
+ if (!namedObjectType) {
3996
+ throw new Error("namedObjectType should be set here");
3934
3997
  }
3935
- if (query?.filter && !objectType.$filter(query.filter, object)) {
3998
+ if (query?.filter && !namedObjectType.$filter(query.filter, object)) {
3936
3999
  continue;
3937
4000
  }
3938
4001
  if (objectI++ >= offset) {