@shaclmate/compiler 4.0.8 → 4.0.10
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/Compiler.d.ts +1 -4
- package/dist/Compiler.js +1 -5
- package/dist/ShapesGraphToAstTransformer.d.ts +2 -11
- package/dist/ShapesGraphToAstTransformer.js +25 -27
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.d.ts +3 -0
- package/dist/_ShapesGraphToAstTransformer/defaultNodeShapeNodeKinds.js +5 -0
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.d.ts +4 -0
- package/dist/_ShapesGraphToAstTransformer/shapeAstTypeName.js +27 -0
- package/dist/_ShapesGraphToAstTransformer/transformPropertyShapeToAstObjectTypeProperty.js +74 -19
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.d.ts +1 -1
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstCompoundType.js +45 -91
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.d.ts +11 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstListType.js +146 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.d.ts +7 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstObjectType.js +182 -0
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstTermType.js +9 -7
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.d.ts +3 -5
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstType.js +33 -10
- package/dist/ast/AbstractCompoundType.d.ts +26 -8
- package/dist/ast/AbstractCompoundType.js +84 -16
- package/dist/ast/AbstractContainerType.d.ts +2 -4
- package/dist/ast/AbstractContainerType.js +3 -4
- package/dist/ast/AbstractLazyObjectType.d.ts +1 -0
- package/dist/ast/AbstractLazyObjectType.js +3 -0
- package/dist/ast/AbstractTermType.d.ts +1 -0
- package/dist/ast/AbstractTermType.js +1 -0
- package/dist/ast/AbstractType.d.ts +16 -1
- package/dist/ast/AbstractType.js +11 -1
- package/dist/ast/Ast.d.ts +5 -5
- package/dist/ast/BlankNodeType.d.ts +1 -1
- package/dist/ast/DefaultValueType.d.ts +1 -2
- package/dist/ast/DefaultValueType.js +2 -0
- package/dist/ast/IdentifierType.d.ts +1 -1
- package/dist/ast/IntersectionType.d.ts +7 -2
- package/dist/ast/IntersectionType.js +8 -0
- package/dist/ast/ListType.d.ts +2 -9
- package/dist/ast/ListType.js +1 -9
- package/dist/ast/LiteralType.d.ts +1 -0
- package/dist/ast/LiteralType.js +26 -0
- package/dist/ast/ObjectCompoundType.d.ts +12 -0
- package/dist/ast/ObjectCompoundType.js +88 -0
- package/dist/ast/ObjectIntersectionType.d.ts +3 -7
- package/dist/ast/ObjectIntersectionType.js +1 -7
- package/dist/ast/ObjectType.d.ts +14 -31
- package/dist/ast/ObjectType.js +41 -73
- package/dist/ast/ObjectUnionType.d.ts +3 -7
- package/dist/ast/ObjectUnionType.js +1 -7
- package/dist/ast/OptionType.d.ts +1 -2
- package/dist/ast/OptionType.js +2 -0
- package/dist/ast/SetType.d.ts +1 -2
- package/dist/ast/SetType.js +2 -0
- package/dist/ast/Type.d.ts +1 -4
- package/dist/ast/Type.js +0 -6
- package/dist/ast/UnionType.d.ts +11 -6
- package/dist/ast/UnionType.js +6 -4
- package/dist/ast/index.d.ts +1 -2
- package/dist/ast/index.js +1 -2
- package/dist/generators/json/AstJsonGenerator.js +17 -15
- package/dist/generators/ts/AbstractCollectionType.d.ts +1 -1
- package/dist/generators/ts/AbstractCollectionType.js +10 -12
- package/dist/generators/ts/AbstractContainerType.d.ts +9 -4
- package/dist/generators/ts/AbstractContainerType.js +10 -3
- package/dist/generators/ts/AbstractDateType.d.ts +2 -2
- package/dist/generators/ts/AbstractDateType.js +2 -2
- package/dist/generators/ts/AbstractIdentifierType.d.ts +1 -1
- package/dist/generators/ts/AbstractIdentifierType.js +1 -1
- package/dist/generators/ts/AbstractLazyObjectType.d.ts +13 -10
- package/dist/generators/ts/AbstractLazyObjectType.js +21 -16
- package/dist/generators/ts/AbstractNamedUnionType.d.ts +33 -0
- package/dist/generators/ts/AbstractNamedUnionType.js +195 -0
- package/dist/generators/ts/AbstractNumericType.d.ts +3 -3
- package/dist/generators/ts/AbstractNumericType.js +4 -4
- package/dist/generators/ts/AbstractTermType.d.ts +7 -4
- package/dist/generators/ts/AbstractTermType.js +7 -4
- package/dist/generators/ts/AbstractType.d.ts +34 -19
- package/dist/generators/ts/AbstractUnionType.d.ts +80 -0
- package/dist/generators/ts/AbstractUnionType.js +514 -0
- package/dist/generators/ts/AnonymousUnionType.d.ts +26 -0
- package/dist/generators/ts/AnonymousUnionType.js +56 -0
- package/dist/generators/ts/BigDecimalType.d.ts +4 -4
- package/dist/generators/ts/BigDecimalType.js +5 -5
- package/dist/generators/ts/BigIntType.d.ts +1 -1
- package/dist/generators/ts/BigIntType.js +1 -1
- package/dist/generators/ts/BlankNodeType.d.ts +2 -2
- package/dist/generators/ts/BlankNodeType.js +2 -2
- package/dist/generators/ts/BooleanType.d.ts +3 -3
- package/dist/generators/ts/BooleanType.js +3 -3
- package/dist/generators/ts/DateTimeType.d.ts +1 -1
- package/dist/generators/ts/DateTimeType.js +1 -1
- package/dist/generators/ts/DateType.d.ts +1 -1
- package/dist/generators/ts/DateType.js +1 -1
- package/dist/generators/ts/DefaultValueType.d.ts +5 -5
- package/dist/generators/ts/DefaultValueType.js +17 -16
- package/dist/generators/ts/IdentifierType.d.ts +2 -2
- package/dist/generators/ts/IdentifierType.js +2 -2
- package/dist/generators/ts/IriType.d.ts +2 -2
- package/dist/generators/ts/IriType.js +2 -2
- package/dist/generators/ts/LazyObjectOptionType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectOptionType.js +10 -10
- package/dist/generators/ts/LazyObjectSetType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectSetType.js +8 -8
- package/dist/generators/ts/LazyObjectType.d.ts +1 -1
- package/dist/generators/ts/LazyObjectType.js +9 -10
- package/dist/generators/ts/ListType.d.ts +9 -8
- package/dist/generators/ts/ListType.js +15 -14
- package/dist/generators/ts/LiteralType.d.ts +2 -2
- package/dist/generators/ts/LiteralType.js +3 -3
- package/dist/generators/ts/NamedObjectType.d.ts +126 -0
- package/dist/generators/ts/NamedObjectType.js +420 -0
- package/dist/generators/ts/NamedObjectUnionType.d.ts +35 -0
- package/dist/generators/ts/NamedObjectUnionType.js +217 -0
- package/dist/generators/ts/NamedUnionType.d.ts +11 -0
- package/dist/generators/ts/NamedUnionType.js +13 -0
- package/dist/generators/ts/OptionType.d.ts +5 -5
- package/dist/generators/ts/OptionType.js +12 -12
- package/dist/generators/ts/SetType.d.ts +4 -4
- package/dist/generators/ts/SetType.js +13 -11
- package/dist/generators/ts/StringType.d.ts +3 -3
- package/dist/generators/ts/StringType.js +3 -3
- package/dist/generators/ts/TermType.d.ts +2 -2
- package/dist/generators/ts/TermType.js +3 -3
- package/dist/generators/ts/TsGenerator.js +28 -20
- package/dist/generators/ts/Type.d.ts +5 -4
- package/dist/generators/ts/TypeFactory.d.ts +9 -7
- package/dist/generators/ts/TypeFactory.js +139 -112
- package/dist/generators/ts/ZodGenerator.js +18 -16
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.d.ts +9 -9
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/AbstractProperty.js +3 -3
- package/dist/generators/ts/{_ObjectType/TypeDiscriminantProperty.d.ts → _NamedObjectType/DiscriminantProperty.d.ts} +14 -14
- package/dist/generators/ts/{_ObjectType/TypeDiscriminantProperty.js → _NamedObjectType/DiscriminantProperty.js} +22 -20
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierPrefixProperty.js +6 -6
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/IdentifierProperty.js +31 -28
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_classDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_classDeclaration.js → _NamedObjectType/NamedObjectType_classDeclaration.js} +15 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_createFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_createFunctionDeclaration.js → _NamedObjectType/NamedObjectType_createFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_equalsFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterFunctionDeclaration.js → _NamedObjectType/NamedObjectType_filterFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_filterTypeDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_filterTypeDeclaration.js → _NamedObjectType/NamedObjectType_filterTypeDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.js → _NamedObjectType/NamedObjectType_focusSparqlConstructTriplesFunctionDeclaration.js} +6 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.js → _NamedObjectType/NamedObjectType_focusSparqlWherePatternsFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromJsonFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfFunctionDeclaration.js → _NamedObjectType/NamedObjectType_fromRdfResourceFunctionDeclaration.js} +6 -7
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfResourceValuesFunctionDeclaration.js +20 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_fromRdfTypeVariableStatement.js → _NamedObjectType/NamedObjectType_fromRdfTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_graphqlTypeVariableStatement.js → _NamedObjectType/NamedObjectType_graphqlTypeVariableStatement.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.js → _NamedObjectType/NamedObjectType_hashFunctionOrMethodDeclarations.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_interfaceDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_interfaceDeclaration.js → _NamedObjectType/NamedObjectType_interfaceDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_isTypeFunctionDeclaration.js → _NamedObjectType/NamedObjectType_isTypeFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonParseFunctionDeclaration.js +19 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonSchemaFunctionDeclaration.js} +5 -5
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonTypeAliasDeclaration.js → _NamedObjectType/NamedObjectType_jsonTypeAliasDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.js → _NamedObjectType/NamedObjectType_jsonUiSchemaFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_objectSetMethodNames.d.ts +9 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_objectSetMethodNames.js → _NamedObjectType/NamedObjectType_objectSetMethodNames.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromJsonFunctionDeclaration.js +38 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.js → _NamedObjectType/NamedObjectType_propertiesFromRdfResourceFunctionDeclaration.js} +16 -15
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_schemaVariableStatement.d.ts +4 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_schemaVariableStatement.js → _NamedObjectType/NamedObjectType_schemaVariableStatement.js} +3 -4
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryFunctionDeclaration.js} +4 -4
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.d.ts} +2 -2
- package/dist/generators/ts/{_ObjectType/ObjectType_sparqlConstructQueryStringFunctionDeclaration.js → _NamedObjectType/NamedObjectType_sparqlConstructQueryStringFunctionDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toJsonFunctionOrMethodDeclaration.js} +2 -2
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.d.ts +5 -0
- package/dist/generators/ts/{_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.js → _NamedObjectType/NamedObjectType_toRdfResourceFunctionOrMethodDeclaration.js} +10 -8
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlConstructTriplesFunctionDeclaration.js +13 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.d.ts +5 -0
- package/dist/generators/ts/_NamedObjectType/NamedObjectType_valueSparqlWherePatternsFunctionDeclaration.js +15 -0
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.d.ts +2 -2
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.d.ts +3 -3
- package/dist/generators/ts/{_ObjectType → _NamedObjectType}/ShaclProperty.js +14 -14
- package/dist/generators/ts/_NamedObjectType/identifierTypeDeclarations.d.ts +4 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlConstructTriplesFunction.js +12 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FocusSparqlWherePatternsFunction.js +14 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceFunction.js +15 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_FromRdfResourceValuesFunction.js +17 -0
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfResourceFunction.js +15 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.d.ts +5 -0
- package/dist/generators/ts/_snippets/snippets_PropertyPath.js +35 -0
- package/dist/generators/ts/_snippets/snippets_ShaclPropertySchema.js +2 -2
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceFunction.js +7 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ToRdfResourceValuesFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlConstructTriplesFunction.js +13 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.d.ts +2 -0
- package/dist/generators/ts/_snippets/snippets_ValueSparqlWherePatternsFunction.js +16 -0
- package/dist/generators/ts/_snippets/snippets_bigDecimalSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_blankNodeSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_booleanEquals.js +1 -1
- package/dist/generators/ts/_snippets/snippets_booleanSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_dateSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_defaultValueSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_fromRdfLanguageIn.js +1 -1
- package/dist/generators/ts/_snippets/snippets_identifierSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_iriSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_listSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_listSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_literalSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_maybeSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_numericSparqlWherePatterns.js +2 -3
- package/dist/generators/ts/_snippets/snippets_setSparqlConstructTriples.js +2 -2
- package/dist/generators/ts/_snippets/snippets_setSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlConstructTriples.js +4 -3
- package/dist/generators/ts/_snippets/snippets_shaclPropertySparqlWherePatterns.js +4 -3
- package/dist/generators/ts/_snippets/snippets_sparqlPropertyPath.js +3 -2
- package/dist/generators/ts/_snippets/snippets_stringSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/_snippets/snippets_termSparqlWherePatterns.js +2 -2
- package/dist/generators/ts/graphqlSchemaVariableStatement.d.ts +4 -4
- package/dist/generators/ts/graphqlSchemaVariableStatement.js +25 -25
- package/dist/generators/ts/imports.d.ts +1 -1
- package/dist/generators/ts/imports.js +1 -1
- package/dist/generators/ts/objectSetDeclarations.d.ts +5 -5
- package/dist/generators/ts/objectSetDeclarations.js +34 -31
- package/dist/generators/ts/objectSetInterfaceDeclaration.d.ts +5 -5
- package/dist/generators/ts/objectSetInterfaceDeclaration.js +6 -4
- package/dist/generators/ts/objectSetMethodSignatures.d.ts +4 -4
- package/dist/generators/ts/objectSetMethodSignatures.js +9 -9
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.d.ts +5 -5
- package/dist/generators/ts/rdfjsDatasetObjectSetClassDeclaration.js +54 -53
- package/dist/generators/ts/singleEntryRecord.d.ts +2 -0
- package/dist/generators/ts/singleEntryRecord.js +6 -0
- package/dist/generators/ts/snippets.d.ts +10 -6
- package/dist/generators/ts/snippets.js +20 -12
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.d.ts +5 -5
- package/dist/generators/ts/sparqlObjectSetClassDeclaration.js +19 -20
- package/dist/generators/ts/synthesizeUberObjectUnionType.d.ts +4 -4
- package/dist/generators/ts/synthesizeUberObjectUnionType.js +14 -9
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.d.ts +5 -5
- package/dist/generators/ts/unsupportedObjectSetMethodDeclarations.js +2 -2
- package/dist/input/NodeShape.d.ts +0 -1
- package/dist/input/NodeShape.js +0 -3
- package/dist/input/ShapesGraph.d.ts +3 -2
- package/dist/input/ShapesGraph.js +12 -7
- package/dist/input/generated.d.ts +1899 -88
- package/dist/input/generated.js +676 -564
- package/package.json +5 -7
- package/dist/_ShapesGraphToAstTransformer/CurieFactory.d.ts +0 -16
- package/dist/_ShapesGraphToAstTransformer/CurieFactory.js +0 -45
- package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.d.ts +0 -3
- package/dist/_ShapesGraphToAstTransformer/NodeShapeAstType.js +0 -2
- package/dist/_ShapesGraphToAstTransformer/index.d.ts +0 -6
- package/dist/_ShapesGraphToAstTransformer/index.js +0 -6
- package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.d.ts +0 -5
- package/dist/_ShapesGraphToAstTransformer/shapeIdentifier.js +0 -9
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.d.ts +0 -11
- package/dist/_ShapesGraphToAstTransformer/transformNodeShapeToAstType.js +0 -338
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.d.ts +0 -12
- package/dist/_ShapesGraphToAstTransformer/transformShapeToAstAbstractTypeProperties.js +0 -31
- package/dist/ast/AbstractObjectCompoundType.d.ts +0 -45
- package/dist/ast/AbstractObjectCompoundType.js +0 -180
- package/dist/ast/Curie.d.ts +0 -21
- package/dist/ast/Curie.js +0 -29
- package/dist/ast/PlaceholderType.d.ts +0 -15
- package/dist/ast/PlaceholderType.js +0 -19
- package/dist/generators/codeName.d.ts +0 -6
- package/dist/generators/codeName.js +0 -66
- package/dist/generators/ts/AbstractDeclaredType.d.ts +0 -23
- package/dist/generators/ts/AbstractDeclaredType.js +0 -17
- package/dist/generators/ts/ObjectType.d.ts +0 -117
- package/dist/generators/ts/ObjectType.js +0 -402
- package/dist/generators/ts/ObjectUnionType.d.ts +0 -65
- package/dist/generators/ts/ObjectUnionType.js +0 -257
- package/dist/generators/ts/UnionType.d.ts +0 -40
- package/dist/generators/ts/UnionType.js +0 -527
- package/dist/generators/ts/_ObjectType/ObjectType_classDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_createFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_equalsFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_filterFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_filterTypeDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_fromJsonFunctionDeclarations.js +0 -66
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_fromRdfTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_hashFunctionOrMethodDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_interfaceDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_isTypeFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonSchemaFunctionDeclaration.js +0 -14
- package/dist/generators/ts/_ObjectType/ObjectType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonUiSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_objectSetMethodNames.d.ts +0 -9
- package/dist/generators/ts/_ObjectType/ObjectType_propertiesFromRdfFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_schemaVariableStatement.d.ts +0 -4
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_sparqlWherePatternsFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toJsonFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/ObjectType_toRdfFunctionOrMethodDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectType/identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/MemberType.d.ts +0 -34
- package/dist/generators/ts/_ObjectUnionType/MemberType.js +0 -105
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_equalsFunctionDeclaration.js +0 -29
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_filterTypeDeclaration.js +0 -10
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromJsonFunctionDeclaration.js +0 -19
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_fromRdfFunctionDeclarations.js +0 -20
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_graphqlTypeVariableStatement.js +0 -18
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_hashFunctionDeclaration.js +0 -28
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_identifierTypeDeclarations.js +0 -9
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_isTypeFunctionDeclaration.js +0 -13
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonTypeAliasDeclaration.js +0 -10
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_jsonZodSchemaFunctionDeclaration.js +0 -14
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_schemaVariableStatement.js +0 -37
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlConstructTriplesFunctionDeclaration.js +0 -15
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_sparqlWherePatternsFunctionDeclaration.js +0 -35
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toJsonFunctionDeclaration.js +0 -26
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.d.ts +0 -5
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_toRdfFunctionDeclarations.js +0 -43
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.d.ts +0 -4
- package/dist/generators/ts/_ObjectUnionType/ObjectUnionType_typeAliasDeclaration.js +0 -10
- package/dist/generators/ts/_snippets/snippets_FromRdfOptions.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_FromRdfOptions.js +0 -5
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_PropertiesFromRdfParameters.js +0 -5
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlConstructTriplesFunctionParameters.js +0 -12
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunction.js +0 -6
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.d.ts +0 -2
- package/dist/generators/ts/_snippets/snippets_SparqlWherePatternsFunctionParameters.js +0 -15
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/Property.js +0 -0
- /package/dist/generators/ts/{_ObjectType → _NamedObjectType}/identifierTypeDeclarations.js +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
|
+
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
3
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
export declare function rdfjsDatasetObjectSetClassDeclaration({
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }: {
|
|
5
|
+
namedObjectTypes: readonly NamedObjectType[];
|
|
6
|
+
namedObjectUnionTypes: readonly NamedObjectUnionType[];
|
|
7
7
|
}): Code;
|
|
8
8
|
//# sourceMappingURL=rdfjsDatasetObjectSetClassDeclaration.d.ts.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { snippets_FromRdfOptions } from "./_snippets/snippets_FromRdfOptions.js";
|
|
2
1
|
import { imports } from "./imports.js";
|
|
3
2
|
import { objectSetMethodSignatures } from "./objectSetMethodSignatures.js";
|
|
4
3
|
import { snippets } from "./snippets.js";
|
|
5
4
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
6
5
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
7
6
|
import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
|
|
8
|
-
export function rdfjsDatasetObjectSetClassDeclaration({
|
|
9
|
-
const
|
|
7
|
+
export function rdfjsDatasetObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
|
|
8
|
+
const namedObjectTypeType = code `\
|
|
10
9
|
{
|
|
11
10
|
${syntheticNamePrefix}filter: (filter: ObjectFilterT, value: ObjectT) => boolean;
|
|
12
|
-
${syntheticNamePrefix}
|
|
11
|
+
${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFunction}<ObjectT>;
|
|
13
12
|
${syntheticNamePrefix}fromRdfTypes: readonly ${imports.NamedNode}[]
|
|
14
13
|
}`;
|
|
15
14
|
const parameters = {
|
|
@@ -42,13 +41,15 @@ export class ${syntheticNamePrefix}RdfjsDatasetObjectSet implements ${syntheticN
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
${joinCode([
|
|
45
|
-
...[...
|
|
46
|
-
if (!
|
|
44
|
+
...[...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
|
|
45
|
+
if (!namedObjectType.features.has("rdf")) {
|
|
47
46
|
return Object.values(unsupportedObjectSetMethodDeclarations({
|
|
48
|
-
|
|
47
|
+
namedObjectType,
|
|
49
48
|
}));
|
|
50
49
|
}
|
|
51
|
-
const methodSignatures = objectSetMethodSignatures({
|
|
50
|
+
const methodSignatures = objectSetMethodSignatures({
|
|
51
|
+
namedObjectType,
|
|
52
|
+
});
|
|
52
53
|
const delegatingMethods = [
|
|
53
54
|
// object
|
|
54
55
|
code `\
|
|
@@ -57,7 +58,7 @@ async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${
|
|
|
57
58
|
}`,
|
|
58
59
|
// objectSync
|
|
59
60
|
code `\
|
|
60
|
-
${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${imports.Either}<Error, ${
|
|
61
|
+
${methodSignatures.object.name}Sync(${methodSignatures.object.parameters}): ${imports.Either}<Error, ${namedObjectType.name}> {
|
|
61
62
|
return this.${methodSignatures.objects.name}Sync({ identifiers: [identifier], preferredLanguages: options?.preferredLanguages }).map(objects => objects[0]);
|
|
62
63
|
}`,
|
|
63
64
|
// objectCount
|
|
@@ -77,7 +78,7 @@ async ${methodSignatures.objectIdentifiers.name}(${methodSignatures.objectIdenti
|
|
|
77
78
|
}`,
|
|
78
79
|
// objectIdentifiersSync
|
|
79
80
|
code `\
|
|
80
|
-
${methodSignatures.objectIdentifiers.name}Sync(${methodSignatures.objectIdentifiers.parameters}): ${imports.Either}<Error, readonly ${
|
|
81
|
+
${methodSignatures.objectIdentifiers.name}Sync(${methodSignatures.objectIdentifiers.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.identifierTypeAlias}[]> {
|
|
81
82
|
return this.${methodSignatures.objects.name}Sync(query).map(objects => objects.map(object => object.${syntheticNamePrefix}identifier));
|
|
82
83
|
}`,
|
|
83
84
|
// objects
|
|
@@ -87,37 +88,37 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
|
|
|
87
88
|
}`,
|
|
88
89
|
// objectsSync has per-object type logic, not just forwarding
|
|
89
90
|
];
|
|
90
|
-
const runtimeObjectType = (filterFunction,
|
|
91
|
-
const fromRdfTypes =
|
|
91
|
+
const runtimeObjectType = (filterFunction, namedObjectType) => {
|
|
92
|
+
const fromRdfTypes = namedObjectType.fromRdfTypeVariable
|
|
92
93
|
.toList()
|
|
93
|
-
.concat(
|
|
94
|
-
return code `{ ${syntheticNamePrefix}filter: ${filterFunction}, ${syntheticNamePrefix}
|
|
94
|
+
.concat(namedObjectType.descendantFromRdfTypeVariables);
|
|
95
|
+
return code `{ ${syntheticNamePrefix}filter: ${filterFunction}, ${syntheticNamePrefix}fromRdfResource: ${namedObjectType.staticModuleName}.${syntheticNamePrefix}fromRdfResource, ${syntheticNamePrefix}fromRdfTypes: ${fromRdfTypes.length > 0 ? code `[${joinCode(fromRdfTypes, { on: ", " })}]` : "[]"} }`;
|
|
95
96
|
};
|
|
96
|
-
switch (
|
|
97
|
-
case "
|
|
97
|
+
switch (namedObjectType.kind) {
|
|
98
|
+
case "NamedObjectType": {
|
|
98
99
|
return delegatingMethods.concat(code `\
|
|
99
|
-
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${
|
|
100
|
-
return this.${syntheticNamePrefix}objectsSync<${
|
|
100
|
+
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
|
|
101
|
+
return this.${syntheticNamePrefix}objectsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType(namedObjectType.filterFunction, namedObjectType)}, query);
|
|
101
102
|
}`);
|
|
102
103
|
}
|
|
103
|
-
case "
|
|
104
|
+
case "NamedObjectUnionType":
|
|
104
105
|
return delegatingMethods.concat(code `\
|
|
105
|
-
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${
|
|
106
|
-
return this.${syntheticNamePrefix}objectUnionsSync<${
|
|
107
|
-
${joinCode(
|
|
108
|
-
.filter((
|
|
109
|
-
.map((
|
|
106
|
+
${methodSignatures.objects.name}Sync(${methodSignatures.objects.parameters}): ${imports.Either}<Error, readonly ${namedObjectType.name}[]> {
|
|
107
|
+
return this.${syntheticNamePrefix}objectUnionsSync<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>([
|
|
108
|
+
${joinCode(namedObjectType.members
|
|
109
|
+
.filter((member) => !member.type.abstract)
|
|
110
|
+
.map((member) => runtimeObjectType(namedObjectType.filterFunction, member.type)), { on: ", " })}
|
|
110
111
|
], query);
|
|
111
112
|
}`);
|
|
112
113
|
default:
|
|
113
|
-
|
|
114
|
+
namedObjectType;
|
|
114
115
|
return [];
|
|
115
116
|
}
|
|
116
117
|
}),
|
|
117
|
-
...(
|
|
118
|
+
...(namedObjectTypes.length > 0
|
|
118
119
|
? [
|
|
119
120
|
code `\
|
|
120
|
-
protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(
|
|
121
|
+
protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectType: ${namedObjectTypeType}, ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
|
|
121
122
|
const graph = query?.graph ?? this.${syntheticNamePrefix}graph;
|
|
122
123
|
|
|
123
124
|
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
@@ -126,7 +127,7 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
|
|
|
126
127
|
let offset = query?.offset ?? 0;
|
|
127
128
|
if (offset < 0) { offset = 0; }
|
|
128
129
|
|
|
129
|
-
const
|
|
130
|
+
const fromRdfResourceOptions: Parameters<${snippets.FromRdfResourceFunction}<ObjectT>>[1] = { graph, objectSet: this, preferredLanguages: query?.preferredLanguages };
|
|
130
131
|
|
|
131
132
|
let resources: { object?: ObjectT, resource: ${imports.Resource} }[];
|
|
132
133
|
const resourceSet = this.${syntheticNamePrefix}resourceSet(); // Access once, in case it's instantiated lazily
|
|
@@ -134,11 +135,11 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
|
|
|
134
135
|
if (query?.identifiers) {
|
|
135
136
|
resources = query.identifiers.map(identifier => ({ resource: resourceSet.resource(identifier) }));
|
|
136
137
|
sortResources = false;
|
|
137
|
-
} else if (
|
|
138
|
+
} else if (namedObjectType.${syntheticNamePrefix}fromRdfTypes.length > 0) {
|
|
138
139
|
const identifierSet = new ${snippets.IdentifierSet}();
|
|
139
140
|
resources = [];
|
|
140
141
|
sortResources = true;
|
|
141
|
-
for (const fromRdfType of
|
|
142
|
+
for (const fromRdfType of namedObjectType.${syntheticNamePrefix}fromRdfTypes) {
|
|
142
143
|
for (const resource of resourceSet.instancesOf(fromRdfType, { graph })) {
|
|
143
144
|
if (!identifierSet.has(resource.identifier)) {
|
|
144
145
|
identifierSet.add(resource.identifier);
|
|
@@ -169,7 +170,7 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
|
|
|
169
170
|
identifierSet.add(quad.subject);
|
|
170
171
|
const resource = resourceSet.resource(quad.subject);
|
|
171
172
|
// Eagerly eliminate the majority of resources that won't match the object type
|
|
172
|
-
|
|
173
|
+
namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
|
|
173
174
|
resources.push({ object, resource });
|
|
174
175
|
});
|
|
175
176
|
}
|
|
@@ -184,14 +185,14 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
|
|
|
184
185
|
const objects: ObjectT[] = [];
|
|
185
186
|
for (let { object, resource } of resources) {
|
|
186
187
|
if (!object) {
|
|
187
|
-
const objectEither =
|
|
188
|
+
const objectEither = namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
|
|
188
189
|
if (objectEither.isLeft()) {
|
|
189
190
|
return objectEither;
|
|
190
191
|
}
|
|
191
192
|
object = objectEither.unsafeCoerce();
|
|
192
193
|
}
|
|
193
194
|
|
|
194
|
-
if (query?.filter && !
|
|
195
|
+
if (query?.filter && !namedObjectType.${syntheticNamePrefix}filter(query.filter, object)) {
|
|
195
196
|
continue;
|
|
196
197
|
}
|
|
197
198
|
|
|
@@ -206,10 +207,10 @@ protected ${syntheticNamePrefix}objectsSync<${typeParameters.ObjectT}, ${typePar
|
|
|
206
207
|
}`,
|
|
207
208
|
]
|
|
208
209
|
: []),
|
|
209
|
-
...(
|
|
210
|
+
...(namedObjectUnionTypes.length > 0
|
|
210
211
|
? [
|
|
211
212
|
code `\
|
|
212
|
-
protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(
|
|
213
|
+
protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(namedObjectTypes: readonly ${namedObjectTypeType}[], ${parameters.query}): ${imports.Either}<Error, readonly ObjectT[]> {
|
|
213
214
|
const graph = query?.graph ?? this.${syntheticNamePrefix}graph;
|
|
214
215
|
|
|
215
216
|
const limit = query?.limit ?? Number.MAX_SAFE_INTEGER;
|
|
@@ -218,24 +219,24 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
|
|
|
218
219
|
let offset = query?.offset ?? 0;
|
|
219
220
|
if (offset < 0) { offset = 0; }
|
|
220
221
|
|
|
221
|
-
const
|
|
222
|
+
const fromRdfResourceOptions: Parameters<${snippets.FromRdfResourceFunction}<ObjectT>>[1] = { graph, objectSet: this, preferredLanguages: query?.preferredLanguages };
|
|
222
223
|
|
|
223
|
-
let resources: { object?: ObjectT,
|
|
224
|
+
let resources: { object?: ObjectT, namedObjectType?: ${namedObjectTypeType}, resource: ${imports.Resource} }[];
|
|
224
225
|
const resourceSet = this.${syntheticNamePrefix}resourceSet(); // Access once, in case it's instantiated lazily
|
|
225
226
|
let sortResources: boolean;
|
|
226
227
|
if (query?.identifiers) {
|
|
227
228
|
resources = query.identifiers.map(identifier => ({ resource: resourceSet.resource(identifier) }));
|
|
228
229
|
sortResources = false;
|
|
229
|
-
} else if (
|
|
230
|
+
} else if (namedObjectTypes.every(namedObjectType => namedObjectType.${syntheticNamePrefix}fromRdfTypes.length > 0)) {
|
|
230
231
|
const identifierSet = new ${snippets.IdentifierSet}();
|
|
231
232
|
resources = [];
|
|
232
233
|
sortResources = true;
|
|
233
|
-
for (const
|
|
234
|
-
for (const fromRdfType of
|
|
234
|
+
for (const namedObjectType of namedObjectTypes) {
|
|
235
|
+
for (const fromRdfType of namedObjectType.${syntheticNamePrefix}fromRdfTypes) {
|
|
235
236
|
for (const resource of resourceSet.instancesOf(fromRdfType, { graph })) {
|
|
236
237
|
if (!identifierSet.has(resource.identifier)) {
|
|
237
238
|
identifierSet.add(resource.identifier);
|
|
238
|
-
resources.push({
|
|
239
|
+
resources.push({ namedObjectType, resource });
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
}
|
|
@@ -263,9 +264,9 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
|
|
|
263
264
|
identifierSet.add(quad.subject);
|
|
264
265
|
// Eagerly eliminate the majority of resources that won't match the object types
|
|
265
266
|
const resource = resourceSet.resource(quad.subject);
|
|
266
|
-
for (const
|
|
267
|
-
if (
|
|
268
|
-
resources.push({ object,
|
|
267
|
+
for (const namedObjectType of namedObjectTypes) {
|
|
268
|
+
if (namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions).ifRight(object => {
|
|
269
|
+
resources.push({ object, namedObjectType, resource });
|
|
269
270
|
}).isRight()) {
|
|
270
271
|
break;
|
|
271
272
|
}
|
|
@@ -280,17 +281,17 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
|
|
|
280
281
|
|
|
281
282
|
let objectI = 0;
|
|
282
283
|
const objects: ObjectT[] = [];
|
|
283
|
-
for (let { object,
|
|
284
|
+
for (let { object, namedObjectType, resource } of resources) {
|
|
284
285
|
if (!object) {
|
|
285
286
|
let objectEither: ${imports.Either}<Error, ObjectT>;
|
|
286
|
-
if (
|
|
287
|
-
objectEither =
|
|
287
|
+
if (namedObjectType) {
|
|
288
|
+
objectEither = namedObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
|
|
288
289
|
} else {
|
|
289
290
|
objectEither = ${imports.Left}(new Error("no object types"));
|
|
290
|
-
for (const tryObjectType of
|
|
291
|
-
objectEither = tryObjectType.${syntheticNamePrefix}
|
|
291
|
+
for (const tryObjectType of namedObjectTypes) {
|
|
292
|
+
objectEither = tryObjectType.${syntheticNamePrefix}fromRdfResource(resource, fromRdfResourceOptions);
|
|
292
293
|
if (objectEither.isRight()) {
|
|
293
|
-
|
|
294
|
+
namedObjectType = tryObjectType;
|
|
294
295
|
break;
|
|
295
296
|
}
|
|
296
297
|
}
|
|
@@ -300,11 +301,11 @@ protected ${syntheticNamePrefix}objectUnionsSync<${typeParameters.ObjectT}, ${ty
|
|
|
300
301
|
}
|
|
301
302
|
object = objectEither.unsafeCoerce();
|
|
302
303
|
}
|
|
303
|
-
if (!
|
|
304
|
-
throw new Error("
|
|
304
|
+
if (!namedObjectType) {
|
|
305
|
+
throw new Error("namedObjectType should be set here");
|
|
305
306
|
}
|
|
306
307
|
|
|
307
|
-
if (query?.filter && !
|
|
308
|
+
if (query?.filter && !namedObjectType.${syntheticNamePrefix}filter(query.filter, object)) {
|
|
308
309
|
continue;
|
|
309
310
|
}
|
|
310
311
|
|
|
@@ -34,9 +34,12 @@ export declare const snippets: {
|
|
|
34
34
|
filterNumeric: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
35
35
|
filterString: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
36
36
|
filterTerm: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
37
|
-
|
|
37
|
+
FocusSparqlConstructTriplesFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
38
|
+
FocusSparqlWherePatternsFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
38
39
|
fromRdfLanguageIn: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
39
40
|
fromRdfPreferredLanguages: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
41
|
+
FromRdfResourceFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
42
|
+
FromRdfResourceValuesFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
40
43
|
Hasher: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
41
44
|
IdentifierFilter: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
42
45
|
identifierFromString: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
@@ -71,7 +74,8 @@ export declare const snippets: {
|
|
|
71
74
|
NumericFilter: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
72
75
|
NumericSchema: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
73
76
|
numericSparqlWherePatterns: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
74
|
-
|
|
77
|
+
PropertiesFromRdfResourceFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
78
|
+
PropertyPath: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
75
79
|
RdfVocabularies: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
76
80
|
shaclPropertyFromRdf: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
77
81
|
ShaclPropertySchema: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
@@ -80,16 +84,12 @@ export declare const snippets: {
|
|
|
80
84
|
setSparqlConstructTriples: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
81
85
|
setSparqlWherePatterns: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
82
86
|
sortSparqlPatterns: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
83
|
-
SparqlConstructTriplesFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
84
|
-
SparqlConstructTriplesFunctionParameters: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
85
87
|
SparqlFilterPattern: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
86
88
|
sparqlInstancesOfPattern: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
87
89
|
SparqlPattern_isSolutionGenerating: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
88
90
|
SparqlPattern: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
89
91
|
sparqlPropertyPath: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
90
92
|
sparqlValueInPattern: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
91
|
-
SparqlWherePatternsFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
92
|
-
SparqlWherePatternsFunctionParameters: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
93
93
|
strictEquals: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
94
94
|
StringFilter: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
95
95
|
StringSchema: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
@@ -99,6 +99,10 @@ export declare const snippets: {
|
|
|
99
99
|
TermSchema: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
100
100
|
termSchemaSparqlPatterns: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
101
101
|
termSparqlWherePatterns: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
102
|
+
ToRdfResourceFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
103
|
+
ToRdfResourceValuesFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
102
104
|
UnwrapR: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
105
|
+
ValueSparqlConstructTriplesFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
106
|
+
ValueSparqlWherePatternsFunction: import("ts-poet/build/ConditionalOutput.js").ConditionalOutput;
|
|
103
107
|
};
|
|
104
108
|
//# sourceMappingURL=snippets.d.ts.map
|
|
@@ -21,7 +21,10 @@ import { snippets_decodeBigDecimalLiteral } from "./_snippets/snippets_decodeBig
|
|
|
21
21
|
import { snippets_deduplicateSparqlPatterns } from "./_snippets/snippets_deduplicateSparqlPatterns.js";
|
|
22
22
|
import { snippets_defaultValueSparqlWherePatterns } from "./_snippets/snippets_defaultValueSparqlWherePatterns.js";
|
|
23
23
|
import { snippets_EqualsResult } from "./_snippets/snippets_EqualsResult.js";
|
|
24
|
-
import {
|
|
24
|
+
import { snippets_FocusSparqlConstructTriplesFunction } from "./_snippets/snippets_FocusSparqlConstructTriplesFunction.js";
|
|
25
|
+
import { snippets_FocusSparqlWherePatternsFunction } from "./_snippets/snippets_FocusSparqlWherePatternsFunction.js";
|
|
26
|
+
import { snippets_FromRdfResourceFunction } from "./_snippets/snippets_FromRdfResourceFunction.js";
|
|
27
|
+
import { snippets_FromRdfResourceValuesFunction } from "./_snippets/snippets_FromRdfResourceValuesFunction.js";
|
|
25
28
|
import { snippets_filterArray } from "./_snippets/snippets_filterArray.js";
|
|
26
29
|
import { snippets_filterBigDecimal } from "./_snippets/snippets_filterBigDecimal.js";
|
|
27
30
|
import { snippets_filterBlankNode } from "./_snippets/snippets_filterBlankNode.js";
|
|
@@ -70,16 +73,13 @@ import { snippets_NumericFilter } from "./_snippets/snippets_NumericFilter.js";
|
|
|
70
73
|
import { snippets_NumericSchema } from "./_snippets/snippets_NumericSchema.js";
|
|
71
74
|
import { snippets_normalizeSparqlWherePatterns } from "./_snippets/snippets_normalizeSparqlWherePatterns.js";
|
|
72
75
|
import { snippets_numericSparqlWherePatterns } from "./_snippets/snippets_numericSparqlWherePatterns.js";
|
|
73
|
-
import {
|
|
76
|
+
import { snippets_PropertiesFromRdfResourceFunction } from "./_snippets/snippets_PropertiesFromRdfResourceFunction.js";
|
|
77
|
+
import { snippets_PropertyPath } from "./_snippets/snippets_PropertyPath.js";
|
|
74
78
|
import { snippets_RdfVocabularies } from "./_snippets/snippets_RdfVocabularies.js";
|
|
75
79
|
import { snippets_ShaclPropertySchema } from "./_snippets/snippets_ShaclPropertySchema.js";
|
|
76
|
-
import { snippets_SparqlConstructTriplesFunction } from "./_snippets/snippets_SparqlConstructTriplesFunction.js";
|
|
77
|
-
import { snippets_SparqlConstructTriplesFunctionParameters } from "./_snippets/snippets_SparqlConstructTriplesFunctionParameters.js";
|
|
78
80
|
import { snippets_SparqlFilterPattern } from "./_snippets/snippets_SparqlFilterPattern.js";
|
|
79
81
|
import { snippets_SparqlPattern } from "./_snippets/snippets_SparqlPattern.js";
|
|
80
82
|
import { snippets_SparqlPattern_isSolutionGenerating } from "./_snippets/snippets_SparqlPattern_isSolutionGenerating.js";
|
|
81
|
-
import { snippets_SparqlWherePatternsFunction } from "./_snippets/snippets_SparqlWherePatternsFunction.js";
|
|
82
|
-
import { snippets_SparqlWherePatternsFunctionParameters } from "./_snippets/snippets_SparqlWherePatternsFunctionParameters.js";
|
|
83
83
|
import { snippets_StringFilter } from "./_snippets/snippets_StringFilter.js";
|
|
84
84
|
import { snippets_StringSchema } from "./_snippets/snippets_StringSchema.js";
|
|
85
85
|
import { snippets_setSparqlConstructTriples } from "./_snippets/snippets_setSparqlConstructTriples.js";
|
|
@@ -95,10 +95,14 @@ import { snippets_strictEquals } from "./_snippets/snippets_strictEquals.js";
|
|
|
95
95
|
import { snippets_stringSparqlWherePatterns } from "./_snippets/snippets_stringSparqlWherePatterns.js";
|
|
96
96
|
import { snippets_TermFilter } from "./_snippets/snippets_TermFilter.js";
|
|
97
97
|
import { snippets_TermSchema } from "./_snippets/snippets_TermSchema.js";
|
|
98
|
+
import { snippets_ToRdfResourceFunction } from "./_snippets/snippets_ToRdfResourceFunction.js";
|
|
99
|
+
import { snippets_ToRdfResourceValuesFunction } from "./_snippets/snippets_ToRdfResourceValuesFunction.js";
|
|
98
100
|
import { snippets_termFilterSparqlPatterns } from "./_snippets/snippets_termFilterSparqlPatterns.js";
|
|
99
101
|
import { snippets_termSchemaSparqlPatterns } from "./_snippets/snippets_termSchemaSparqlPatterns.js";
|
|
100
102
|
import { snippets_termSparqlWherePatterns } from "./_snippets/snippets_termSparqlWherePatterns.js";
|
|
101
103
|
import { snippets_UnwrapR } from "./_snippets/snippets_UnwrapR.js";
|
|
104
|
+
import { snippets_ValueSparqlConstructTriplesFunction } from "./_snippets/snippets_ValueSparqlConstructTriplesFunction.js";
|
|
105
|
+
import { snippets_ValueSparqlWherePatternsFunction } from "./_snippets/snippets_ValueSparqlWherePatternsFunction.js";
|
|
102
106
|
export const snippets = {
|
|
103
107
|
arrayIntersection: snippets_arrayIntersection,
|
|
104
108
|
arrayEquals: snippets_arrayEquals,
|
|
@@ -135,9 +139,12 @@ export const snippets = {
|
|
|
135
139
|
filterNumeric: snippets_filterNumeric,
|
|
136
140
|
filterString: snippets_filterString,
|
|
137
141
|
filterTerm: snippets_filterTerm,
|
|
138
|
-
|
|
142
|
+
FocusSparqlConstructTriplesFunction: snippets_FocusSparqlConstructTriplesFunction,
|
|
143
|
+
FocusSparqlWherePatternsFunction: snippets_FocusSparqlWherePatternsFunction,
|
|
139
144
|
fromRdfLanguageIn: snippets_fromRdfLanguageIn,
|
|
140
145
|
fromRdfPreferredLanguages: snippets_fromRdfPreferredLanguages,
|
|
146
|
+
FromRdfResourceFunction: snippets_FromRdfResourceFunction,
|
|
147
|
+
FromRdfResourceValuesFunction: snippets_FromRdfResourceValuesFunction,
|
|
141
148
|
Hasher: snippets_Hasher,
|
|
142
149
|
IdentifierFilter: snippets_IdentifierFilter,
|
|
143
150
|
identifierFromString: snippets_identifierFromString,
|
|
@@ -172,7 +179,8 @@ export const snippets = {
|
|
|
172
179
|
NumericFilter: snippets_NumericFilter,
|
|
173
180
|
NumericSchema: snippets_NumericSchema,
|
|
174
181
|
numericSparqlWherePatterns: snippets_numericSparqlWherePatterns,
|
|
175
|
-
|
|
182
|
+
PropertiesFromRdfResourceFunction: snippets_PropertiesFromRdfResourceFunction,
|
|
183
|
+
PropertyPath: snippets_PropertyPath,
|
|
176
184
|
RdfVocabularies: snippets_RdfVocabularies,
|
|
177
185
|
shaclPropertyFromRdf: snippets_shaclPropertyFromRdf,
|
|
178
186
|
ShaclPropertySchema: snippets_ShaclPropertySchema,
|
|
@@ -181,16 +189,12 @@ export const snippets = {
|
|
|
181
189
|
setSparqlConstructTriples: snippets_setSparqlConstructTriples,
|
|
182
190
|
setSparqlWherePatterns: snippets_setSparqlWherePatterns,
|
|
183
191
|
sortSparqlPatterns: snippets_sortSparqlPatterns,
|
|
184
|
-
SparqlConstructTriplesFunction: snippets_SparqlConstructTriplesFunction,
|
|
185
|
-
SparqlConstructTriplesFunctionParameters: snippets_SparqlConstructTriplesFunctionParameters,
|
|
186
192
|
SparqlFilterPattern: snippets_SparqlFilterPattern,
|
|
187
193
|
sparqlInstancesOfPattern: snippets_sparqlInstancesOfPattern,
|
|
188
194
|
SparqlPattern_isSolutionGenerating: snippets_SparqlPattern_isSolutionGenerating,
|
|
189
195
|
SparqlPattern: snippets_SparqlPattern,
|
|
190
196
|
sparqlPropertyPath: snippets_sparqlPropertyPath,
|
|
191
197
|
sparqlValueInPattern: snippets_sparqlValueInPattern,
|
|
192
|
-
SparqlWherePatternsFunction: snippets_SparqlWherePatternsFunction,
|
|
193
|
-
SparqlWherePatternsFunctionParameters: snippets_SparqlWherePatternsFunctionParameters,
|
|
194
198
|
strictEquals: snippets_strictEquals,
|
|
195
199
|
StringFilter: snippets_StringFilter,
|
|
196
200
|
StringSchema: snippets_StringSchema,
|
|
@@ -200,6 +204,10 @@ export const snippets = {
|
|
|
200
204
|
TermSchema: snippets_TermSchema,
|
|
201
205
|
termSchemaSparqlPatterns: snippets_termSchemaSparqlPatterns,
|
|
202
206
|
termSparqlWherePatterns: snippets_termSparqlWherePatterns,
|
|
207
|
+
ToRdfResourceFunction: snippets_ToRdfResourceFunction,
|
|
208
|
+
ToRdfResourceValuesFunction: snippets_ToRdfResourceValuesFunction,
|
|
203
209
|
UnwrapR: snippets_UnwrapR,
|
|
210
|
+
ValueSparqlConstructTriplesFunction: snippets_ValueSparqlConstructTriplesFunction,
|
|
211
|
+
ValueSparqlWherePatternsFunction: snippets_ValueSparqlWherePatternsFunction,
|
|
204
212
|
};
|
|
205
213
|
//# sourceMappingURL=snippets.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
|
+
import type { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
3
3
|
import { type Code } from "./ts-poet-wrapper.js";
|
|
4
|
-
export declare function sparqlObjectSetClassDeclaration({
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare function sparqlObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }: {
|
|
5
|
+
namedObjectTypes: readonly NamedObjectType[];
|
|
6
|
+
namedObjectUnionTypes: readonly NamedObjectUnionType[];
|
|
7
7
|
}): Code;
|
|
8
8
|
//# sourceMappingURL=sparqlObjectSetClassDeclaration.d.ts.map
|
|
@@ -4,16 +4,15 @@ import { snippets } from "./snippets.js";
|
|
|
4
4
|
import { syntheticNamePrefix } from "./syntheticNamePrefix.js";
|
|
5
5
|
import { code, joinCode } from "./ts-poet-wrapper.js";
|
|
6
6
|
import { unsupportedObjectSetMethodDeclarations } from "./unsupportedObjectSetMethodDeclarations.js";
|
|
7
|
-
export function sparqlObjectSetClassDeclaration({
|
|
8
|
-
const sparqlWherePatternsFunctionType = code `(parameters: { filter: ObjectFilterT | undefined; focusIdentifier: ${imports.NamedNode} | ${imports.Variable}; ignoreRdfType: boolean; preferredLanguages: readonly string[] | undefined; variablePrefix: string; }) => readonly ${imports.sparqljs}.Pattern[]`;
|
|
7
|
+
export function sparqlObjectSetClassDeclaration({ namedObjectTypes, namedObjectUnionTypes, }) {
|
|
9
8
|
const parameters = {
|
|
10
|
-
constructObjectType: code `
|
|
11
|
-
${syntheticNamePrefix}
|
|
9
|
+
constructObjectType: code `namedObjectType: {\
|
|
10
|
+
${syntheticNamePrefix}focusSparqlWherePatterns: ${snippets.FocusSparqlWherePatternsFunction}<ObjectFilterT>;
|
|
11
|
+
${syntheticNamePrefix}fromRdfResource: ${snippets.FromRdfResourceFunction}<ObjectT>;
|
|
12
12
|
${syntheticNamePrefix}sparqlConstructQueryString: (parameters: { filter?: ObjectFilterT; subject: ${imports.NamedNode} | ${imports.Variable}; } & Omit<${imports.sparqljs}.ConstructQuery, "prefixes" | "queryType" | "type"> & ${imports.sparqljs}.GeneratorOptions) => string;
|
|
13
|
-
${syntheticNamePrefix}sparqlWherePatterns: ${sparqlWherePatternsFunctionType};
|
|
14
13
|
}`,
|
|
15
14
|
query: code `query?: ${syntheticNamePrefix}SparqlObjectSet.Query<ObjectFilterT, ObjectIdentifierT>`,
|
|
16
|
-
selectObjectTypeType: code `
|
|
15
|
+
selectObjectTypeType: code `namedObjectType: { ${syntheticNamePrefix}focusSparqlWherePatterns: ${snippets.FocusSparqlWherePatternsFunction}<ObjectFilterT> }`,
|
|
17
16
|
};
|
|
18
17
|
const typeParameters = {
|
|
19
18
|
ObjectT: code `ObjectT extends { readonly $identifier: ObjectIdentifierT }`,
|
|
@@ -31,17 +30,17 @@ export class ${syntheticNamePrefix}SparqlObjectSet implements ${syntheticNamePre
|
|
|
31
30
|
this.graph = options?.graph;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
${joinCode([...
|
|
35
|
-
if (!
|
|
33
|
+
${joinCode([...namedObjectTypes, ...namedObjectUnionTypes].flatMap((namedObjectType) => {
|
|
34
|
+
if (!namedObjectType.features.has("sparql")) {
|
|
36
35
|
return Object.values(unsupportedObjectSetMethodDeclarations({
|
|
37
|
-
|
|
36
|
+
namedObjectType,
|
|
38
37
|
}));
|
|
39
38
|
}
|
|
40
39
|
const methodSignatures = objectSetMethodSignatures({
|
|
41
|
-
|
|
40
|
+
namedObjectType,
|
|
42
41
|
queryT: `${syntheticNamePrefix}SparqlObjectSet.Query`,
|
|
43
42
|
});
|
|
44
|
-
const runtimeObjectType =
|
|
43
|
+
const runtimeObjectType = namedObjectType.staticModuleName;
|
|
45
44
|
return [
|
|
46
45
|
code `\
|
|
47
46
|
async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${methodSignatures.object.returnType} {
|
|
@@ -49,15 +48,15 @@ async ${methodSignatures.object.name}(${methodSignatures.object.parameters}): ${
|
|
|
49
48
|
}`,
|
|
50
49
|
code `\
|
|
51
50
|
async ${methodSignatures.objectCount.name}(${methodSignatures.objectCount.parameters}): ${methodSignatures.objectCount.returnType} {
|
|
52
|
-
return this.${syntheticNamePrefix}objectCount<${
|
|
51
|
+
return this.${syntheticNamePrefix}objectCount<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
|
|
53
52
|
}`,
|
|
54
53
|
code `\
|
|
55
54
|
async ${methodSignatures.objectIdentifiers.name}(${methodSignatures.objectIdentifiers.parameters}): ${methodSignatures.objectIdentifiers.returnType} {
|
|
56
|
-
return this.${syntheticNamePrefix}objectIdentifiers<${
|
|
55
|
+
return this.${syntheticNamePrefix}objectIdentifiers<${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
|
|
57
56
|
}`,
|
|
58
57
|
code `\
|
|
59
58
|
async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}): ${methodSignatures.objects.returnType} {
|
|
60
|
-
return this.${syntheticNamePrefix}objects<${
|
|
59
|
+
return this.${syntheticNamePrefix}objects<${namedObjectType.name}, ${namedObjectType.filterType}, ${namedObjectType.identifierTypeAlias}>(${runtimeObjectType}, query);
|
|
61
60
|
}`,
|
|
62
61
|
];
|
|
63
62
|
}), { on: "\n\n" })}
|
|
@@ -112,7 +111,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
|
|
|
112
111
|
offset = 0;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
const wherePatterns = this.${syntheticNamePrefix}wherePatterns(
|
|
114
|
+
const wherePatterns = this.${syntheticNamePrefix}wherePatterns(namedObjectType, query);
|
|
116
115
|
if (wherePatterns.length === 0) {
|
|
117
116
|
return ${imports.Left}(new Error("no SPARQL WHERE patterns for identifiers"));
|
|
118
117
|
}
|
|
@@ -140,12 +139,12 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
|
|
|
140
139
|
|
|
141
140
|
protected async ${syntheticNamePrefix}objects<${typeParameters.ObjectT}, ${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.constructObjectType}, ${parameters.query}): Promise<${imports.Either}<Error, readonly ObjectT[]>> {
|
|
142
141
|
return ${imports.EitherAsync}(async ({ liftEither }) => {
|
|
143
|
-
const identifiers = await liftEither(await this.${syntheticNamePrefix}objectIdentifiers<ObjectFilterT, ObjectIdentifierT>(
|
|
142
|
+
const identifiers = await liftEither(await this.${syntheticNamePrefix}objectIdentifiers<ObjectFilterT, ObjectIdentifierT>(namedObjectType, query));
|
|
144
143
|
if (identifiers.length === 0) {
|
|
145
144
|
return [];
|
|
146
145
|
}
|
|
147
146
|
|
|
148
|
-
const constructQueryString =
|
|
147
|
+
const constructQueryString = namedObjectType.${syntheticNamePrefix}sparqlConstructQueryString({
|
|
149
148
|
subject: this.${syntheticNamePrefix}objectVariable,
|
|
150
149
|
where: [{
|
|
151
150
|
type: "values" as const,
|
|
@@ -162,14 +161,14 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
|
|
|
162
161
|
const dataset = ${imports.datasetFactory}.dataset(quads.concat());
|
|
163
162
|
const objects: ObjectT[] = [];
|
|
164
163
|
for (const identifier of identifiers) {
|
|
165
|
-
objects.push(await liftEither(
|
|
164
|
+
objects.push(await liftEither(namedObjectType.${syntheticNamePrefix}fromRdfResource(new ${imports.Resource}(dataset, identifier as ${imports.NamedNode}), { objectSet: this, preferredLanguages: query?.preferredLanguages })));
|
|
166
165
|
}
|
|
167
166
|
return objects;
|
|
168
167
|
});
|
|
169
168
|
}
|
|
170
169
|
|
|
171
170
|
protected async ${syntheticNamePrefix}objectCount<${typeParameters.ObjectFilterT}, ${typeParameters.ObjectIdentifierT}>(${parameters.selectObjectTypeType}, ${parameters.query}): Promise<${imports.Either}<Error, number>> {
|
|
172
|
-
const wherePatterns = this.${syntheticNamePrefix}wherePatterns(
|
|
171
|
+
const wherePatterns = this.${syntheticNamePrefix}wherePatterns(namedObjectType, query);
|
|
173
172
|
if (wherePatterns.length === 0) {
|
|
174
173
|
return ${imports.Left}(new Error("no SPARQL WHERE patterns for count"));
|
|
175
174
|
}
|
|
@@ -211,7 +210,7 @@ async ${methodSignatures.objects.name}(${methodSignatures.objects.parameters}):
|
|
|
211
210
|
patterns = patterns.concat(query.where(this.${syntheticNamePrefix}objectVariable));
|
|
212
211
|
}
|
|
213
212
|
|
|
214
|
-
patterns = patterns.concat(
|
|
213
|
+
patterns = patterns.concat(namedObjectType.${syntheticNamePrefix}focusSparqlWherePatterns({ filter: query?.filter, focusIdentifier: this.${syntheticNamePrefix}objectVariable, ignoreRdfType: false, preferredLanguages: query?.preferredLanguages, variablePrefix: this.${syntheticNamePrefix}objectVariable.value }));
|
|
215
214
|
|
|
216
215
|
patterns = ${snippets.normalizeSparqlWherePatterns}(patterns).concat();
|
|
217
216
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { NamedObjectType } from "./NamedObjectType.js";
|
|
2
|
+
import { NamedObjectUnionType } from "./NamedObjectUnionType.js";
|
|
3
3
|
/**
|
|
4
4
|
* Synthesize the $Object union.
|
|
5
5
|
*/
|
|
6
6
|
export declare function synthesizeUberObjectUnionType(parameters: {
|
|
7
|
-
|
|
8
|
-
}):
|
|
7
|
+
namedObjectTypes: readonly NamedObjectType[];
|
|
8
|
+
}): NamedObjectUnionType;
|
|
9
9
|
//# sourceMappingURL=synthesizeUberObjectUnionType.d.ts.map
|