@shaclmate/compiler 4.0.24 → 4.0.26

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.
Files changed (90) hide show
  1. package/dist/Compiler.d.ts +1 -1
  2. package/dist/ShapesGraphToAstTransformer.d.ts +1 -1
  3. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.d.ts +1 -1
  4. package/dist/_ShapesGraphToAstTransformer/nodeShapeTsFeatures.js +5 -2
  5. package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +0 -6
  6. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +0 -2
  7. package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +14 -32
  8. package/dist/ast/AbstractCompoundType.d.ts +1 -1
  9. package/dist/ast/ObjectType.d.ts +3 -23
  10. package/dist/ast/ObjectType.js +2 -20
  11. package/dist/generators/ts/AbstractContainerType.d.ts +0 -1
  12. package/dist/generators/ts/AbstractContainerType.js +0 -1
  13. package/dist/generators/ts/AbstractLazyObjectType.d.ts +0 -1
  14. package/dist/generators/ts/AbstractLazyObjectType.js +2 -2
  15. package/dist/generators/ts/AbstractNamedUnionType.d.ts +1 -2
  16. package/dist/generators/ts/AbstractNamedUnionType.js +16 -19
  17. package/dist/generators/ts/AbstractTermType.d.ts +0 -1
  18. package/dist/generators/ts/AbstractTermType.js +0 -1
  19. package/dist/generators/ts/AbstractType.d.ts +0 -4
  20. package/dist/generators/ts/AbstractUnionType.d.ts +1 -10
  21. package/dist/generators/ts/AbstractUnionType.js +26 -39
  22. package/dist/generators/ts/LazyObjectOptionType.js +3 -2
  23. package/dist/generators/ts/LazyObjectSetType.js +2 -1
  24. package/dist/generators/ts/LazyObjectType.js +2 -1
  25. package/dist/generators/ts/NamedObjectType.d.ts +2 -13
  26. package/dist/generators/ts/NamedObjectType.js +33 -104
  27. package/dist/generators/ts/NamedObjectUnionType.js +13 -24
  28. package/dist/generators/ts/TsGenerator.js +15 -7
  29. package/dist/generators/ts/TypeFactory.js +10 -28
  30. package/dist/generators/ts/ZodGenerator.js +2 -2
  31. package/dist/generators/ts/_NamedObjectType/AbstractProperty.d.ts +1 -7
  32. package/dist/generators/ts/_NamedObjectType/AbstractProperty.js +1 -6
  33. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.d.ts +0 -1
  34. package/dist/generators/ts/_NamedObjectType/DiscriminantProperty.js +4 -31
  35. package/dist/generators/ts/_NamedObjectType/IdentifierProperty.js +6 -17
  36. package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.js +2 -2
  37. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.d.ts +5 -0
  38. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionDeclaration.js +25 -0
  39. package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.js +1 -1
  40. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js +1 -1
  41. package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js +1 -1
  42. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +1 -4
  43. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js +1 -4
  44. package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +1 -4
  45. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.d.ts +4 -0
  46. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionDeclarations.js +49 -0
  47. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +0 -3
  48. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js +1 -1
  49. package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js +1 -1
  50. package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.js +8 -3
  51. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +2 -2
  52. package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js +2 -2
  53. package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.js +1 -1
  54. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts +1 -2
  55. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js +2 -2
  56. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts +2 -2
  57. package/dist/generators/ts/_NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js +2 -2
  58. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionDeclaration.d.ts +5 -0
  59. package/dist/generators/ts/_NamedObjectType/{NamedObjectType_toJsonFunctionOrMethodDeclaration.js → NamedObjectType_toJsonFunctionDeclaration.js} +5 -27
  60. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionDeclaration.d.ts +5 -0
  61. package/dist/generators/ts/_NamedObjectType/{NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js → NamedObjectType_toRdfResourceFunctionDeclaration.js} +4 -25
  62. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.d.ts +4 -0
  63. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionDeclarations.js +40 -0
  64. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +1 -1
  65. package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +1 -1
  66. package/dist/generators/ts/_NamedObjectType/ShaclProperty.js +6 -28
  67. package/dist/generators/ts/_snippets/snippets_compactRecord.js +1 -1
  68. package/dist/generators/ts/objectSetDeclarations.js +1 -3
  69. package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +6 -8
  70. package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +40 -37
  71. package/dist/input/ShapesGraph.d.ts +1 -1
  72. package/dist/input/generated.d.ts +0 -134
  73. package/dist/input/generated.js +12 -239
  74. package/package.json +2 -4
  75. package/dist/enums/TsObjectDeclarationType.d.ts +0 -9
  76. package/dist/enums/TsObjectDeclarationType.js +0 -16
  77. package/dist/enums/Visibility.d.ts +0 -6
  78. package/dist/enums/Visibility.js +0 -18
  79. package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +0 -4
  80. package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.js +0 -61
  81. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
  82. package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js +0 -52
  83. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
  84. package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js +0 -77
  85. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
  86. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +0 -5
  87. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.d.ts +0 -4
  88. package/dist/generators/ts/_NamedObjectType/NamedObjectType_toStringFunctionOrMethodDeclaration.js +0 -66
  89. /package/dist/{enums → generators/ts}/TsFeature.d.ts +0 -0
  90. /package/dist/{enums → generators/ts}/TsFeature.js +0 -0
@@ -839,22 +839,6 @@ export var PropertyShape;
839
839
  else {
840
840
  uniqueLang = parameters.uniqueLang;
841
841
  }
842
- let visibility;
843
- if (Maybe.isMaybe(parameters.visibility)) {
844
- visibility = parameters.visibility;
845
- }
846
- else if (typeof parameters.visibility === "object") {
847
- visibility = Maybe.of(parameters.visibility);
848
- }
849
- else if (typeof parameters.visibility === "string") {
850
- visibility = Maybe.of(dataFactory.namedNode(parameters.visibility));
851
- }
852
- else if (parameters.visibility === undefined) {
853
- visibility = Maybe.empty();
854
- }
855
- else {
856
- visibility = parameters.visibility;
857
- }
858
842
  let xone;
859
843
  if (Maybe.isMaybe(parameters.xone)) {
860
844
  xone = parameters.xone;
@@ -909,7 +893,6 @@ export var PropertyShape;
909
893
  resolve,
910
894
  shaclmateName,
911
895
  uniqueLang,
912
- visibility,
913
896
  xone,
914
897
  };
915
898
  }
@@ -1064,10 +1047,6 @@ export var PropertyShape;
1064
1047
  !$filterMaybe($filterBoolean)(filter.uniqueLang, value.uniqueLang)) {
1065
1048
  return false;
1066
1049
  }
1067
- if (filter.visibility !== undefined &&
1068
- !$filterMaybe($filterIri)(filter.visibility, value.visibility)) {
1069
- return false;
1070
- }
1071
1050
  if (filter.xone !== undefined &&
1072
1051
  !$filterMaybe($filterArray($filterIdentifier))(filter.xone, value.xone)) {
1073
1052
  return false;
@@ -1812,30 +1791,6 @@ export var PropertyShape;
1812
1791
  value: Maybe.empty(),
1813
1792
  })),
1814
1793
  }).chain((uniqueLang) => $shaclPropertyFromRdf({
1815
- graph: _$options.graph,
1816
- resource: $resource,
1817
- propertySchema: PropertyShape.$schema
1818
- .properties
1819
- .visibility,
1820
- typeFromRdf: (resourceValues) => resourceValues
1821
- .chain((values) => values.chainMap((value) => value.toIri([
1822
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_Visibility_Private"),
1823
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_Visibility_Protected"),
1824
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_Visibility_Public"),
1825
- ])))
1826
- .map((values) => values.length >
1827
- 0
1828
- ? values.map((value) => Maybe.of(value))
1829
- : Resource.Values.fromValue({
1830
- focusResource: $resource,
1831
- propertyPath: PropertyShape
1832
- .$schema
1833
- .properties
1834
- .visibility
1835
- .path,
1836
- value: Maybe.empty(),
1837
- })),
1838
- }).chain((visibility) => $shaclPropertyFromRdf({
1839
1794
  graph: _$options.graph,
1840
1795
  resource: $resource,
1841
1796
  propertySchema: PropertyShape.$schema
@@ -1905,9 +1860,8 @@ export var PropertyShape;
1905
1860
  resolve,
1906
1861
  shaclmateName,
1907
1862
  uniqueLang,
1908
- visibility,
1909
1863
  xone,
1910
- })))))))))))))))))))))))))))))))))))))))));
1864
+ }))))))))))))))))))))))))))))))))))))))));
1911
1865
  };
1912
1866
  PropertyShape.$schema = {
1913
1867
  properties: {
@@ -2222,21 +2176,6 @@ export var PropertyShape;
2222
2176
  }),
2223
2177
  path: dataFactory.namedNode("http://www.w3.org/ns/shacl#uniqueLang"),
2224
2178
  },
2225
- visibility: {
2226
- kind: "Shacl",
2227
- type: () => ({
2228
- kind: "Maybe",
2229
- item: () => ({
2230
- kind: "Iri",
2231
- in: [
2232
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_Visibility_Private"),
2233
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_Visibility_Protected"),
2234
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_Visibility_Public"),
2235
- ],
2236
- }),
2237
- }),
2238
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#visibility"),
2239
- },
2240
2179
  xone: {
2241
2180
  kind: "Shacl",
2242
2181
  type: () => ({
@@ -2430,7 +2369,6 @@ export var PropertyShape;
2430
2369
  .flatMap((value) => [
2431
2370
  $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
2432
2371
  ]), options?.graph);
2433
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#visibility"), _propertyShape.visibility.toList(), options?.graph);
2434
2372
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _propertyShape.xone.toList().flatMap((value) => [
2435
2373
  value.length > 0
2436
2374
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
@@ -2774,23 +2712,6 @@ export var Ontology;
2774
2712
  else {
2775
2713
  tsImports = parameters?.tsImports;
2776
2714
  }
2777
- let tsObjectDeclarationType;
2778
- if (Maybe.isMaybe(parameters?.tsObjectDeclarationType)) {
2779
- tsObjectDeclarationType = parameters?.tsObjectDeclarationType;
2780
- }
2781
- else if (typeof parameters?.tsObjectDeclarationType === "object") {
2782
- tsObjectDeclarationType = Maybe.of(parameters?.tsObjectDeclarationType);
2783
- }
2784
- else if (typeof parameters?.tsObjectDeclarationType === "string") {
2785
- tsObjectDeclarationType = Maybe.of(dataFactory.namedNode(parameters?.tsObjectDeclarationType));
2786
- }
2787
- else if (parameters?.tsObjectDeclarationType === undefined) {
2788
- tsObjectDeclarationType = Maybe.empty();
2789
- }
2790
- else {
2791
- tsObjectDeclarationType =
2792
- parameters?.tsObjectDeclarationType;
2793
- }
2794
2715
  return {
2795
2716
  $identifier,
2796
2717
  $type,
@@ -2799,7 +2720,6 @@ export var Ontology;
2799
2720
  tsFeatureExcludes,
2800
2721
  tsFeatureIncludes,
2801
2722
  tsImports,
2802
- tsObjectDeclarationType,
2803
2723
  };
2804
2724
  }
2805
2725
  Ontology.$create = $create;
@@ -2833,10 +2753,6 @@ export var Ontology;
2833
2753
  !$filterArray($filterString)(filter.tsImports, value.tsImports)) {
2834
2754
  return false;
2835
2755
  }
2836
- if (filter.tsObjectDeclarationType !== undefined &&
2837
- !$filterMaybe($filterIri)(filter.tsObjectDeclarationType, value.tsObjectDeclarationType)) {
2838
- return false;
2839
- }
2840
2756
  return true;
2841
2757
  }
2842
2758
  Ontology.$filter = $filter;
@@ -2981,24 +2897,7 @@ export var Ontology;
2981
2897
  propertyPath: Ontology.$schema.properties.tsImports.path,
2982
2898
  value: valuesArray,
2983
2899
  })),
2984
- }).chain((tsImports) => $shaclPropertyFromRdf({
2985
- graph: _$options.graph,
2986
- resource: $resource,
2987
- propertySchema: Ontology.$schema.properties.tsObjectDeclarationType,
2988
- typeFromRdf: (resourceValues) => resourceValues
2989
- .chain((values) => values.chainMap((value) => value.toIri([
2990
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
2991
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
2992
- ])))
2993
- .map((values) => values.length > 0
2994
- ? values.map((value) => Maybe.of(value))
2995
- : Resource.Values.fromValue({
2996
- focusResource: $resource,
2997
- propertyPath: Ontology.$schema.properties
2998
- .tsObjectDeclarationType.path,
2999
- value: Maybe.empty(),
3000
- })),
3001
- }).map((tsObjectDeclarationType) => ({
2900
+ }).map((tsImports) => ({
3002
2901
  $identifier,
3003
2902
  $type,
3004
2903
  comment,
@@ -3006,8 +2905,7 @@ export var Ontology;
3006
2905
  tsFeatureExcludes,
3007
2906
  tsFeatureIncludes,
3008
2907
  tsImports,
3009
- tsObjectDeclarationType,
3010
- }))))))))));
2908
+ })))))))));
3011
2909
  };
3012
2910
  Ontology.$schema = {
3013
2911
  properties: {
@@ -3090,20 +2988,6 @@ export var Ontology;
3090
2988
  }),
3091
2989
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"),
3092
2990
  },
3093
- tsObjectDeclarationType: {
3094
- kind: "Shacl",
3095
- type: () => ({
3096
- kind: "Maybe",
3097
- item: () => ({
3098
- kind: "Iri",
3099
- in: [
3100
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
3101
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
3102
- ],
3103
- }),
3104
- }),
3105
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
3106
- },
3107
2991
  },
3108
2992
  };
3109
2993
  function $toRdfResource(_ontology, options) {
@@ -3125,7 +3009,6 @@ export var Ontology;
3125
3009
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), _ontology.tsFeatureExcludes.flatMap((item) => [item]), options?.graph);
3126
3010
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), _ontology.tsFeatureIncludes.flatMap((item) => [item]), options?.graph);
3127
3011
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), _ontology.tsImports.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
3128
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"), _ontology.tsObjectDeclarationType.toList(), options?.graph);
3129
3012
  return resource;
3130
3013
  }
3131
3014
  Ontology.$toRdfResource = $toRdfResource;
@@ -3163,19 +3046,6 @@ export var NodeShape;
3163
3046
  $identifier = $identifierParameter;
3164
3047
  }
3165
3048
  const $type = "NodeShape";
3166
- let abstract;
3167
- if (Maybe.isMaybe(parameters?.abstract)) {
3168
- abstract = parameters?.abstract;
3169
- }
3170
- else if (typeof parameters?.abstract === "boolean") {
3171
- abstract = Maybe.of(parameters?.abstract);
3172
- }
3173
- else if (parameters?.abstract === undefined) {
3174
- abstract = Maybe.empty();
3175
- }
3176
- else {
3177
- abstract = parameters?.abstract;
3178
- }
3179
3049
  let and;
3180
3050
  if (Maybe.isMaybe(parameters?.and)) {
3181
3051
  and = parameters?.and;
@@ -3770,23 +3640,6 @@ export var NodeShape;
3770
3640
  else {
3771
3641
  tsImports = parameters?.tsImports;
3772
3642
  }
3773
- let tsObjectDeclarationType;
3774
- if (Maybe.isMaybe(parameters?.tsObjectDeclarationType)) {
3775
- tsObjectDeclarationType = parameters?.tsObjectDeclarationType;
3776
- }
3777
- else if (typeof parameters?.tsObjectDeclarationType === "object") {
3778
- tsObjectDeclarationType = Maybe.of(parameters?.tsObjectDeclarationType);
3779
- }
3780
- else if (typeof parameters?.tsObjectDeclarationType === "string") {
3781
- tsObjectDeclarationType = Maybe.of(dataFactory.namedNode(parameters?.tsObjectDeclarationType));
3782
- }
3783
- else if (parameters?.tsObjectDeclarationType === undefined) {
3784
- tsObjectDeclarationType = Maybe.empty();
3785
- }
3786
- else {
3787
- tsObjectDeclarationType =
3788
- parameters?.tsObjectDeclarationType;
3789
- }
3790
3643
  let types;
3791
3644
  if (parameters?.types === undefined) {
3792
3645
  types = [];
@@ -3819,7 +3672,6 @@ export var NodeShape;
3819
3672
  return {
3820
3673
  $identifier,
3821
3674
  $type,
3822
- abstract,
3823
3675
  and,
3824
3676
  classes,
3825
3677
  closed,
@@ -3858,7 +3710,6 @@ export var NodeShape;
3858
3710
  tsFeatureExcludes,
3859
3711
  tsFeatureIncludes,
3860
3712
  tsImports,
3861
- tsObjectDeclarationType,
3862
3713
  types,
3863
3714
  xone,
3864
3715
  };
@@ -3874,10 +3725,6 @@ export var NodeShape;
3874
3725
  !$filterIdentifier(filter.$identifier, value.$identifier())) {
3875
3726
  return false;
3876
3727
  }
3877
- if (filter.abstract !== undefined &&
3878
- !$filterMaybe($filterBoolean)(filter.abstract, value.abstract)) {
3879
- return false;
3880
- }
3881
3728
  if (filter.and !== undefined &&
3882
3729
  !$filterMaybe($filterArray($filterIdentifier))(filter.and, value.and)) {
3883
3730
  return false;
@@ -4030,10 +3877,6 @@ export var NodeShape;
4030
3877
  !$filterArray($filterString)(filter.tsImports, value.tsImports)) {
4031
3878
  return false;
4032
3879
  }
4033
- if (filter.tsObjectDeclarationType !== undefined &&
4034
- !$filterMaybe($filterIri)(filter.tsObjectDeclarationType, value.tsObjectDeclarationType)) {
4035
- return false;
4036
- }
4037
3880
  if (filter.types !== undefined &&
4038
3881
  !$filterArray($filterIri)(filter.types, value.types)) {
4039
3882
  return false;
@@ -4099,19 +3942,6 @@ export var NodeShape;
4099
3942
  .chain((values) => values.chainMap((value) => value.toIdentifier()))
4100
3943
  .chain((values) => values.head())
4101
3944
  .chain(($identifier) => Right("NodeShape").chain(($type) => $shaclPropertyFromRdf({
4102
- graph: _$options.graph,
4103
- resource: $resource,
4104
- propertySchema: NodeShape.$schema.properties.abstract,
4105
- typeFromRdf: (resourceValues) => resourceValues
4106
- .chain((values) => values.chainMap((value) => value.toBoolean()))
4107
- .map((values) => values.length > 0
4108
- ? values.map((value) => Maybe.of(value))
4109
- : Resource.Values.fromValue({
4110
- focusResource: $resource,
4111
- propertyPath: NodeShape.$schema.properties.abstract.path,
4112
- value: Maybe.empty(),
4113
- })),
4114
- }).chain((abstract) => $shaclPropertyFromRdf({
4115
3945
  graph: _$options.graph,
4116
3946
  resource: $resource,
4117
3947
  propertySchema: NodeShape.$schema.properties.and,
@@ -4166,8 +3996,7 @@ export var NodeShape;
4166
3996
  ? values.map((value) => Maybe.of(value))
4167
3997
  : Resource.Values.fromValue({
4168
3998
  focusResource: $resource,
4169
- propertyPath: PropertyShape.$schema.properties.comment
4170
- .path,
3999
+ propertyPath: PropertyShape.$schema.properties.comment.path,
4171
4000
  value: Maybe.empty(),
4172
4001
  })),
4173
4002
  }).chain((comment) => $shaclPropertyFromRdf({
@@ -4271,8 +4100,8 @@ export var NodeShape;
4271
4100
  expectedValueType: "(NamedNode | Literal)",
4272
4101
  focusResource: $resource,
4273
4102
  propertyPath: PropertyShape.$schema
4274
- .properties
4275
- .hasValues.path,
4103
+ .properties.hasValues
4104
+ .path,
4276
4105
  }));
4277
4106
  }
4278
4107
  })))
@@ -4358,8 +4187,8 @@ export var NodeShape;
4358
4187
  : Resource.Values.fromValue({
4359
4188
  focusResource: $resource,
4360
4189
  propertyPath: PropertyShape.$schema
4361
- .properties
4362
- .isDefinedBy.path,
4190
+ .properties.isDefinedBy
4191
+ .path,
4363
4192
  value: Maybe.empty(),
4364
4193
  })),
4365
4194
  }).chain((isDefinedBy) => $shaclPropertyFromRdf({
@@ -4402,8 +4231,7 @@ export var NodeShape;
4402
4231
  ? values.map((value) => Maybe.of(value))
4403
4232
  : Resource.Values.fromValue({
4404
4233
  focusResource: $resource,
4405
- propertyPath: PropertyShape
4406
- .$schema
4234
+ propertyPath: PropertyShape.$schema
4407
4235
  .properties
4408
4236
  .languageIn.path,
4409
4237
  value: Maybe.empty(),
@@ -4506,8 +4334,7 @@ export var NodeShape;
4506
4334
  typeFromRdf: (resourceValues) => resourceValues
4507
4335
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
4508
4336
  .chain((values) => values.chainMap((value) => value.toLiteral()))
4509
- .map((values) => values.length >
4510
- 0
4337
+ .map((values) => values.length > 0
4511
4338
  ? values.map((value) => Maybe.of(value))
4512
4339
  : Resource.Values.fromValue({
4513
4340
  focusResource: $resource,
@@ -4521,8 +4348,7 @@ export var NodeShape;
4521
4348
  }).chain((minExclusive) => $shaclPropertyFromRdf({
4522
4349
  graph: _$options.graph,
4523
4350
  resource: $resource,
4524
- propertySchema: NodeShape.$schema
4525
- .properties
4351
+ propertySchema: NodeShape.$schema.properties
4526
4352
  .minInclusive,
4527
4353
  typeFromRdf: (resourceValues) => resourceValues
4528
4354
  .chain((values) => $fromRdfPreferredLanguages(values, _$options.preferredLanguages))
@@ -4866,29 +4692,6 @@ export var NodeShape;
4866
4692
  value: valuesArray,
4867
4693
  })),
4868
4694
  }).chain((tsImports) => $shaclPropertyFromRdf({
4869
- graph: _$options.graph,
4870
- resource: $resource,
4871
- propertySchema: NodeShape.$schema
4872
- .properties
4873
- .tsObjectDeclarationType,
4874
- typeFromRdf: (resourceValues) => resourceValues
4875
- .chain((values) => values.chainMap((value) => value.toIri([
4876
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
4877
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
4878
- ])))
4879
- .map((values) => values.length >
4880
- 0
4881
- ? values.map((value) => Maybe.of(value))
4882
- : Resource.Values.fromValue({
4883
- focusResource: $resource,
4884
- propertyPath: Ontology
4885
- .$schema
4886
- .properties
4887
- .tsObjectDeclarationType
4888
- .path,
4889
- value: Maybe.empty(),
4890
- })),
4891
- }).chain((tsObjectDeclarationType) => $shaclPropertyFromRdf({
4892
4695
  graph: _$options.graph,
4893
4696
  resource: $resource,
4894
4697
  propertySchema: NodeShape.$schema
@@ -4941,7 +4744,6 @@ export var NodeShape;
4941
4744
  }).map((xone) => ({
4942
4745
  $identifier,
4943
4746
  $type,
4944
- abstract,
4945
4747
  and,
4946
4748
  classes,
4947
4749
  closed,
@@ -4980,10 +4782,9 @@ export var NodeShape;
4980
4782
  tsFeatureExcludes,
4981
4783
  tsFeatureIncludes,
4982
4784
  tsImports,
4983
- tsObjectDeclarationType,
4984
4785
  types,
4985
4786
  xone,
4986
- }))))))))))))))))))))))))))))))))))))))))))))));
4787
+ }))))))))))))))))))))))))))))))))))))))))))));
4987
4788
  };
4988
4789
  NodeShape.$schema = {
4989
4790
  properties: {
@@ -4998,14 +4799,6 @@ export var NodeShape;
4998
4799
  ownValues: ["NodeShape"],
4999
4800
  }),
5000
4801
  },
5001
- abstract: {
5002
- kind: "Shacl",
5003
- type: () => ({
5004
- kind: "Maybe",
5005
- item: () => ({ kind: "Boolean" }),
5006
- }),
5007
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#abstract"),
5008
- },
5009
4802
  and: {
5010
4803
  kind: "Shacl",
5011
4804
  type: () => ({
@@ -5363,20 +5156,6 @@ export var NodeShape;
5363
5156
  }),
5364
5157
  path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"),
5365
5158
  },
5366
- tsObjectDeclarationType: {
5367
- kind: "Shacl",
5368
- type: () => ({
5369
- kind: "Maybe",
5370
- item: () => ({
5371
- kind: "Iri",
5372
- in: [
5373
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class"),
5374
- dataFactory.namedNode("http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface"),
5375
- ],
5376
- }),
5377
- }),
5378
- path: dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"),
5379
- },
5380
5159
  types: {
5381
5160
  kind: "Shacl",
5382
5161
  type: () => ({
@@ -5408,11 +5187,6 @@ export var NodeShape;
5408
5187
  if (!options?.ignoreRdfType) {
5409
5188
  resource.add($RdfVocabularies.rdf.type, dataFactory.namedNode("http://www.w3.org/ns/shacl#NodeShape"), options?.graph);
5410
5189
  }
5411
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#abstract"), _nodeShape.abstract
5412
- .toList()
5413
- .flatMap((value) => [
5414
- $literalFactory.boolean(value, $RdfVocabularies.xsd.boolean),
5415
- ]), options?.graph);
5416
5190
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#and"), _nodeShape.and.toList().flatMap((value) => [
5417
5191
  value.length > 0
5418
5192
  ? value.reduce(({ currentSubListResource, listResource }, item, itemIndex, list) => {
@@ -5596,7 +5370,6 @@ export var NodeShape;
5596
5370
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureExclude"), _nodeShape.tsFeatureExcludes.flatMap((item) => [item]), options?.graph);
5597
5371
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsFeatureInclude"), _nodeShape.tsFeatureIncludes.flatMap((item) => [item]), options?.graph);
5598
5372
  resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsImport"), _nodeShape.tsImports.flatMap((item) => [$literalFactory.string(item)]), options?.graph);
5599
- resource.add(dataFactory.namedNode("http://purl.org/shaclmate/ontology#tsObjectDeclarationType"), _nodeShape.tsObjectDeclarationType.toList(), options?.graph);
5600
5373
  resource.add($RdfVocabularies.rdf.type, _nodeShape.types.flatMap((item) => [item]), options?.graph);
5601
5374
  resource.add(dataFactory.namedNode("http://www.w3.org/ns/shacl#xone"), _nodeShape.xone.toList().flatMap((value) => [
5602
5375
  value.length > 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "dependencies": {
3
- "@shaclmate/shacl-ast": "4.0.24",
3
+ "@shaclmate/shacl-ast": "4.0.26",
4
4
  "@rdfjs/dataset": "~2.0.2",
5
5
  "@rdfjs/prefix-map": "~0.1.2",
6
6
  "@rdfjs/term-map": "~2.0.2",
@@ -37,8 +37,6 @@
37
37
  "dist/_ShapesGraphToAstTransformer/*.js",
38
38
  "dist/ast/*.d.ts",
39
39
  "dist/ast/*.js",
40
- "dist/enums/*.d.ts",
41
- "dist/enums/*.js",
42
40
  "dist/generators/*.d.ts",
43
41
  "dist/generators/*.js",
44
42
  "dist/generators/ts/*.d.ts",
@@ -70,5 +68,5 @@
70
68
  },
71
69
  "type": "module",
72
70
  "types": "./dist/index.d.ts",
73
- "version": "4.0.24"
71
+ "version": "4.0.26"
74
72
  }
@@ -1,9 +0,0 @@
1
- import type { NamedNode } from "@rdfjs/types";
2
- /**
3
- * TypeScript enum corresponding to shaclmate:tsObjectDeclarationType, for simpler manipulation.
4
- */
5
- export type TsObjectDeclarationType = "class" | "interface";
6
- export declare namespace TsObjectDeclarationType {
7
- function fromIri(iri: NamedNode<"http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class" | "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface">): TsObjectDeclarationType;
8
- }
9
- //# sourceMappingURL=TsObjectDeclarationType.d.ts.map
@@ -1,16 +0,0 @@
1
- export var TsObjectDeclarationType;
2
- (function (TsObjectDeclarationType) {
3
- function fromIri(iri) {
4
- switch (iri.value) {
5
- case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Class":
6
- return "class";
7
- case "http://purl.org/shaclmate/ontology#_TsObjectDeclarationType_Interface":
8
- return "interface";
9
- default:
10
- iri.value;
11
- throw new RangeError(iri.value);
12
- }
13
- }
14
- TsObjectDeclarationType.fromIri = fromIri;
15
- })(TsObjectDeclarationType || (TsObjectDeclarationType = {}));
16
- //# sourceMappingURL=TsObjectDeclarationType.js.map
@@ -1,6 +0,0 @@
1
- import type { NamedNode } from "@rdfjs/types";
2
- export type Visibility = "private" | "protected" | "public";
3
- export declare namespace Visibility {
4
- function fromIri(iri: NamedNode<"http://purl.org/shaclmate/ontology#_Visibility_Private" | "http://purl.org/shaclmate/ontology#_Visibility_Protected" | "http://purl.org/shaclmate/ontology#_Visibility_Public">): Visibility;
5
- }
6
- //# sourceMappingURL=Visibility.d.ts.map
@@ -1,18 +0,0 @@
1
- export var Visibility;
2
- (function (Visibility) {
3
- function fromIri(iri) {
4
- switch (iri.value) {
5
- case "http://purl.org/shaclmate/ontology#_Visibility_Private":
6
- return "private";
7
- case "http://purl.org/shaclmate/ontology#_Visibility_Protected":
8
- return "protected";
9
- case "http://purl.org/shaclmate/ontology#_Visibility_Public":
10
- return "public";
11
- default:
12
- iri.value;
13
- throw new RangeError(iri.value);
14
- }
15
- }
16
- Visibility.fromIri = fromIri;
17
- })(Visibility || (Visibility = {}));
18
- //# sourceMappingURL=Visibility.js.map
@@ -1,4 +0,0 @@
1
- import type { NamedObjectType } from "../NamedObjectType.js";
2
- import { type Code } from "../ts-poet-wrapper.js";
3
- export declare function NamedObjectType_classDeclaration(this: NamedObjectType): Code;
4
- //# sourceMappingURL=NamedObjectType_classDeclaration.d.ts.map
@@ -1,61 +0,0 @@
1
- import { code, def, joinCode } from "../ts-poet-wrapper.js";
2
- import { tsComment } from "../tsComment.js";
3
- import { NamedObjectType_equalsFunctionOrMethodDeclaration } from "./NamedObjectType_equalsFunctionOrMethodDeclaration.js";
4
- import { NamedObjectType_hashFunctionOrMethodDeclarations } from "./NamedObjectType_hashFunctionOrMethodDeclarations.js";
5
- import { NamedObjectType_toJsonFunctionOrMethodDeclaration } from "./NamedObjectType_toJsonFunctionOrMethodDeclaration.js";
6
- import { NamedObjectType_toRdfResourceFunctionOrMethodDeclaration } from "./NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js";
7
- import { NamedObjectType_toStringFunctionOrMethodDeclarations } from "./NamedObjectType_toStringFunctionOrMethodDeclaration.js";
8
- function NamedObjectType_constructorDeclaration() {
9
- const parametersPropertySignatures = this.properties.flatMap((property) => property.constructorParametersSignature.toList());
10
- const parametersType = [];
11
- if (parametersPropertySignatures.length > 0) {
12
- parametersType.push(code `{ ${joinCode(parametersPropertySignatures)} }`);
13
- }
14
- if (this.parentObjectTypes.length > 0) {
15
- // Pass up parameters
16
- parametersType.push(code `ConstructorParameters<typeof ${this.parentObjectTypes[0].name}>[0]`);
17
- }
18
- if (parametersType.length === 0) {
19
- parametersType.push(code `object`);
20
- }
21
- const statements = [];
22
- if (this.parentObjectTypes.length > 0) {
23
- // An ancestor object type may be extern so we always have a constructor and always pass up parameters instead
24
- // of trying to sense whether we need to or not.
25
- statements.push(code `super(parameters);`);
26
- }
27
- const parametersHasQuestionToken = this.parentObjectTypes.length === 0 &&
28
- parametersPropertySignatures.every((propertySignature) => propertySignature.toCodeString([]).indexOf("?:") !== -1);
29
- const parametersVariable = code `parameters${parametersHasQuestionToken ? "?" : ""}`;
30
- const propertyStatements = this.properties.flatMap((property) => property.constructorStatements({
31
- variables: {
32
- parameter: code `${parametersVariable}.${property.name}`,
33
- parameters: parametersVariable,
34
- },
35
- }));
36
- statements.push(...propertyStatements);
37
- return code `\
38
- ${propertyStatements.length === 0 ? "// biome-ignore lint/complexity/noUselessConstructor: Always have a constructor" : ""}
39
- constructor(${statements.length > 0 ? "parameters" : "_parameters"}${parametersHasQuestionToken ? "?" : ""}: ${joinCode(parametersType, { on: " & " })}) {
40
- ${joinCode(statements)}
41
- }`;
42
- }
43
- export function NamedObjectType_classDeclaration() {
44
- this.ensureAtMostOneSuperObjectType();
45
- return code `\
46
- ${this.comment
47
- .alt(this.label)
48
- .map(tsComment)
49
- .orDefault("")}export ${this.abstract ? "abstract " : ""}class ${def(this.name)}${this.parentObjectTypes.length > 0 ? ` extends ${this.parentObjectTypes[0].name}` : ""} {
50
- ${joinCode([
51
- ...this.properties.flatMap((property) => property.declaration),
52
- NamedObjectType_constructorDeclaration.call(this),
53
- ...NamedObjectType_equalsFunctionOrMethodDeclaration.call(this).toList(),
54
- ...NamedObjectType_hashFunctionOrMethodDeclarations.call(this),
55
- ...NamedObjectType_toJsonFunctionOrMethodDeclaration.call(this).toList(),
56
- ...NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.call(this).toList(),
57
- ...NamedObjectType_toStringFunctionOrMethodDeclarations.call(this),
58
- ], { on: "\n\n" })}
59
- }`;
60
- }
61
- //# sourceMappingURL=NamedObjectType_classDeclaration.js.map
@@ -1,5 +0,0 @@
1
- import { Maybe } from "purify-ts";
2
- import type { NamedObjectType } from "../NamedObjectType.js";
3
- import { type Code } from "../ts-poet-wrapper.js";
4
- export declare function NamedObjectType_equalsFunctionOrMethodDeclaration(this: NamedObjectType): Maybe<Code>;
5
- //# sourceMappingURL=NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts.map