ONSdigital / csvw-check

A CLI to validate CSV-Ws (W3C's CSV on the Web standard).
Apache License 2.0
1 stars 1 forks source link

`@language` tag not being validated correctly #101

Closed robons closed 1 year ago

robons commented 2 years ago

When a CSV-W metadata file has an RDF property using the @language property, the validation fails (incorrectly).

"http://purl.org/dc/terms/title": {
        "@language": "en",
        "@value": "Year"
}

Test-case available here yields the following error:

09:04:37.635 [main] DEBUG CSVValidation.Validator - common property has invalid @language (en)
09:04:37.637 [main] DEBUG CSVValidation.Validator - CSVValidation.PropertyChecker$.ProcessCommonPropertyLanguage(PropertyChecker.scala:267)
CSVValidation.PropertyChecker$.$anonfun$checkCommonPropertyValue$1(PropertyChecker.scala:190)
CSVValidation.PropertyChecker$.$anonfun$checkCommonPropertyValue$1$adapted(PropertyChecker.scala:161)
scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
CSVValidation.PropertyChecker$.checkCommonPropertyValue(PropertyChecker.scala:161)
CSVValidation.PropertyChecker$.$anonfun$checkCommonPropertyValue$1(PropertyChecker.scala:197)
CSVValidation.PropertyChecker$.$anonfun$checkCommonPropertyValue$1$adapted(PropertyChecker.scala:161)
scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
CSVValidation.PropertyChecker$.checkCommonPropertyValue(PropertyChecker.scala:161)
CSVValidation.PropertyChecker$.$anonfun$checkCommonPropertyValue$2(PropertyChecker.scala:225)
scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
CSVValidation.PropertyChecker$.checkCommonPropertyValue(PropertyChecker.scala:223)
CSVValidation.PropertyChecker$.checkProperty(PropertyChecker.scala:124)
CSVValidation.Table$.$anonfun$partitionAndValidateTablePropertiesByType$2(Table.scala:91)
scala.collection.ArrayOps$WithFilter.foreach(ArrayOps.scala:73)
CSVValidation.Table$.partitionAndValidateTablePropertiesByType(Table.scala:77)
CSVValidation.Table$.fromJson(Table.scala:30)
CSVValidation.TableGroup$.$anonfun$extractTablesFromNode$1(TableGroup.scala:422)
scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
CSVValidation.TableGroup$.extractTablesFromNode(TableGroup.scala:396)
CSVValidation.TableGroup$.createTableObjectsAndSetWarnings(TableGroup.scala:379)
CSVValidation.TableGroup$.fromJson(TableGroup.scala:60)
CSVValidation.Schema$.fromCsvwMetadata(Schema.scala:40)
CSVValidation.Validator.attemptToFindMatchingTableGroup(Validator.scala:83)
CSVValidation.Validator.findAndValidateCsvwSchemaFileForCsv(Validator.scala:192)
CSVValidation.Validator.validate(Validator.scala:165)
Main$.delayedEndpoint$Main$1(Main.scala:34)
Main$delayedInit$body.apply(Main.scala:13)
scala.Function0.apply$mcV$sp(Function0.scala:39)
scala.Function0.apply$mcV$sp$(Function0.scala:39)
scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
scala.App.$anonfun$main$1(App.scala:76)
scala.App.$anonfun$main$1$adapted(App.scala:76)
scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
scala.collection.AbstractIterable.foreach(Iterable.scala:919)
scala.App.main(App.scala:76)
scala.App.main$(App.scala:74)
Main$.main(Main.scala:13)
Main.main(Main.scala)
Error
09:04:37.695 [actor-system-akka.actor.default-dispatcher-5] WARN ROOT - Type: metadata, Category: CSVValidation.MetadataError, Row: , Column: , Content: common property has invalid @language (en), Constraints:  

For the record, en is a valid language.