Skip to content

Commit

Permalink
revert message for error (prevented by shape)
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomociti committed May 27, 2024
1 parent 9c39c12 commit 3719ba9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
12 changes: 1 addition & 11 deletions apis/core/lib/domain/column-mapping/ColumnMapping.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { NamedNode } from '@rdfjs/types'
import { Constructor } from '@tpluscode/rdfine'
import { xsd } from '@tpluscode/rdf-ns-builders'
import { Initializer, RdfResourceCore } from '@tpluscode/rdfine/RdfResource'
import { cc } from '@cube-creator/core/namespace'
import * as Schema from '@rdfine/schema'
Expand All @@ -27,16 +26,7 @@ declare module '@cube-creator/model' {
export function LiteralColumnMappingMixin<Base extends Constructor<Omit<LiteralColumnMapping, keyof ApiColumnMapping>>>(Resource: Base): Constructor<ApiColumnMapping & RdfResourceCore> & Base {
return class extends Resource implements ApiColumnMapping {
setErrors() {
delete this.errors
const errors: Array<Initializer<Schema.Thing>> = []

if (this.language && this.datatype && !xsd.string.equals(this.datatype)) {
errors.push({
description: 'either set language or datatype, not both',
})
}

this.errors = errors as any
//
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions apis/core/test/domain/column-mapping/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('domain/column-mapping/create', () => {
.node($rdf.namedNode(''))
.addOut(cc.sourceColumn, $rdf.namedNode('my-column'))
.addOut(cc.targetProperty, $rdf.namedNode('test'))
.addOut(cc.datatype, xsd.integer) // becomes rdf.langString because of language
.addOut(cc.datatype, xsd.string) // becomes rdf.langString because of language
.addOut(cc.language, $rdf.literal('fr'))
.addOut(cc.defaultValue, $rdf.literal('test'))

Expand All @@ -121,7 +121,6 @@ describe('domain/column-mapping/create', () => {
minCount: 1,
}, {
path: cc.datatype,
// hasValue: xsd.integer,
hasValue: rdf.langString,
minCount: 1,
}, {
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/column-mapping/update-literal.hydra
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ With Class cc:LiteralColumnMapping {
a cc:ColumnMapping, cc:LiteralColumnMapping ;
cc:sourceColumn <cube-project/ubd/csv-source/ubd/column/station> ;
cc:targetProperty schema:identifier ;
cc:datatype xsd:integer ;
cc:datatype xsd:string ;
cc:language "en" ;
.
```
Expand All @@ -38,7 +38,7 @@ With Class cc:LiteralColumnMapping {
Expect Id <https://cube-creator.lndo.site/cube-project/ubd/csv-source/ubd/column/station>
}
Expect Property cc:datatype {
Expect Id xsd:integer
Expect Id xsd:string
}
Expect Property cc:language "en"
}
Expand Down

0 comments on commit 3719ba9

Please sign in to comment.