Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csvw:aboutUrl bug when dimension column contains URI-unsafe characters #525

Closed
robons opened this issue Jun 15, 2022 · 0 comments
Closed

Comments

@robons
Copy link
Contributor

robons commented Jun 15, 2022

When generating a CSV-W which contains URI-unsafe characters in a dimension column, csv2rdf of the output fails due to invalid aboutUrls being generated.

Performing CSV2RDF operation with arguments atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-2020.ttl
 Exception in thread "main" java.lang.IllegalArgumentException: Illegal character in fragment at index 206: atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-2020.csv#obs/1990,http://gss-data.org.uk/data/gss_data/climate-change/ons-atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-2020#concept/sic-2007/consumer-expenditure,ghg-total@mass-of-air-emissions-of-carbon-dioxide-equivalent
 	at java.base/java.net.URI.create(URI.java:906)
 	at java.base/java.net.URI.resolve(URI.java:1089)
 	at csv2rdf.util$resolve_uri.invokeStatic(util.clj:115)
 	at csv2rdf.util$resolve_uri.invoke(util.clj:105)
 	at csv2rdf.metadata.uri_template_property$resolve_uri_template_property.invokeStatic(uri_template_property.clj:22)
 	at csv2rdf.metadata.uri_template_property$resolve_uri_template_property.invoke(uri_template_property.clj:17)
 	at csv2rdf.tabular.csv$get_cell_urls.invokeStatic(csv.clj:138)
 	at csv2rdf.tabular.csv$get_cell_urls.invoke(csv.clj:137)
 	at csv2rdf.tabular.csv$annotate_row$fn__7904.invoke(csv.clj:149)
 	at clojure.core$map$fn__5851.invoke(core.clj:2755)
 	at clojure.lang.LazySeq.sval(LazySeq.java:42)
 	at clojure.lang.LazySeq.seq(LazySeq.java:51)
 	at clojure.lang.RT.seq(RT.java:531)
 	at clojure.lang.LazilyPersistentVector.create(LazilyPersistentVector.java:44)
 	at clojure.core$vec.invokeStatic(core.clj:377)
 	at clojure.core$vec.invoke(core.clj:367)
 	at csv2rdf.tabular.csv$annotate_row.invokeStatic(csv.clj:154)
 	at csv2rdf.tabular.csv$annotate_row.invoke(csv.clj:143)
 	at csv2rdf.tabular.csv$annotate_rows$fn__7919.invoke(csv.clj:182)
 	at clojure.core$map$fn__5851.invoke(core.clj:2753)
 	at clojure.lang.LazySeq.sval(LazySeq.java:42)
 	at clojure.lang.LazySeq.seq(LazySeq.java:51)
 	at clojure.lang.RT.seq(RT.java:531)
 	at clojure.core$seq__5387.invokeStatic(core.clj:137)
 	at clojure.core$seq__5387.invoke(core.clj:137)
 	at csv2rdf.util$liberal_mapcat.invokeStatic(util.clj:287)
 	at csv2rdf.util$liberal_mapcat.invoke(util.clj:284)
 	at csv2rdf.util$liberal_mapcat$fn__3776.invoke(util.clj:288)
 	at clojure.lang.LazySeq.sval(LazySeq.java:42)
 	at clojure.lang.LazySeq.seq(LazySeq.java:58)
 	at clojure.lang.RT.seq(RT.java:531)
 	at clojure.core$seq__5387.invokeStatic(core.clj:137)
 	at clojure.core$concat$fn__5478.invoke(core.clj:725)
 	at clojure.lang.LazySeq.sval(LazySeq.java:42)
 	at clojure.lang.LazySeq.seq(LazySeq.java:51)
 	at clojure.lang.RT.seq(RT.java:531)
 	at clojure.core$seq__5387.invokeStatic(core.clj:137)
 	at clojure.core$seq__5387.invoke(core.clj:137)
 	at grafter_2.rdf4j.io$eval8966$fn__8969.invoke(io.clj:553)
 	at grafter_2.rdf.protocols$eval6914$fn__6915$G__6905__6946.invoke(protocols.cljc:45)
 	at csv2rdf.csvw$csv__GT_rdf__GT_destination.invokeStatic(csvw.clj:44)
 	at csv2rdf.csvw$csv__GT_rdf__GT_destination.invoke(csvw.clj:39)
 	at csv2rdf.csvw$csv__GT_rdf__GT_file.invokeStatic(csvw.clj:53)
 	at csv2rdf.csvw$csv__GT_rdf__GT_file.invoke(csvw.clj:46)
 	at clojure.lang.Var.invoke(Var.java:399)
 	at uk.gsscogs.build.Csv2Rdf$.convertFile(Csv2Rdf.scala:19)
 	at uk.gsscogs.build.Operator$.validateAndPerformCsv2RdfOp(Operator.scala:151)
 	at uk.gsscogs.build.Operator$.$anonfun$performOperationsForFile$1(Operator.scala:49)
 	at uk.gsscogs.build.Operator$.$anonfun$performOperationsForFile$1$adapted(Operator.scala:46)
 	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
 	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
 	at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
 	at uk.gsscogs.build.Operator$.performOperationsInternal$1(Operator.scala:46)
 	at uk.gsscogs.build.Operator$.performOperationsForFile(Operator.scala:84)
 	at uk.gsscogs.build.Operator$.performOperations(Operator.scala:27)
 	at uk.gsscogs.build.Main$.delayedEndpoint$uk$gsscogs$build$Main$1(Main.scala:37)
 	at uk.gsscogs.build.Main$delayedInit$body.apply(Main.scala:11)
 	at scala.Function0.apply$mcV$sp(Function0.scala:39)
 	at scala.Function0.apply$mcV$sp$(Function0.scala:39)
 	at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
 	at scala.App.$anonfun$main$1(App.scala:76)
 	at scala.App.$anonfun$main$1$adapted(App.scala:76)
 	at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
 	at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
 	at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
 	at scala.App.main(App.scala:76)
 	at scala.App.main$(App.scala:74)
 	at uk.gsscogs.build.Main$.main(Main.scala:11)
 	at uk.gsscogs.build.Main.main(Main.scala)
 Caused by: java.net.URISyntaxException: Illegal character in fragment at index 206: atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-2020.csv#obs/1990,http://gss-data.org.uk/data/gss_data/climate-change/ons-atmospheric-emissions-greenhouse-gases-by-industry-and-gas-1990-2020#concept/sic-2007/consumer-expenditure,ghg-total@mass-of-air-emissions-of-carbon-dioxide-equivalent
 	at java.base/java.net.URI$Parser.fail(URI.java:2974)
 	at java.base/java.net.URI$Parser.checkChars(URI.java:3145)
 	at java.base/java.net.URI$Parser.parse(URI.java:3189)
 	at java.base/java.net.URI.<init>(URI.java:623)
 	at java.base/java.net.URI.create(URI.java:904)
 	... 68 more
@robons robons changed the title csvw:aboutUrl bug when column contains URI-unsafe characters csvw:aboutUrl bug when dimension column contains URI-unsafe characters Jun 15, 2022
robons added a commit that referenced this issue Jun 15, 2022
… can cope successfully with invalid URI chars. (#526)
@robons robons closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant