dracor-org / fredracor

French Drama Corpus
5 stars 1 forks source link

CSV metadata table unreachable #22

Closed lucagiovannini7 closed 1 year ago

lucagiovannini7 commented 1 year ago

As of now, it is not possible to download the csv metadata table at https://dracor.org/api/corpora/fre/metadata/csv. The JSON table is working, though. Error message:

HTTP ERROR 500 javax.servlet.ServletException: javax.servlet.ServletException: An error occurred while processing request to /exist/restxq/v0/corpora/fre/metadata/csv: err:XPTY0004 checking function parameter 1 in call string-join(untyped-value-check[xs:anyAtomicType, for <697> $c in $api:metadata-columns return <698> if ( count($m($c)) = 0 ) then "" else dutil:csv-escape(untyped-value-check[xs:string, $m($c)]) ], "",""): XPTY0004: The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: dutil:csv-escape($string as xs:string) xs:string. Expected cardinality: exactly one, got 2. [at line 698, column 74, source: /db/apps/dracor-v0/modules/api.xqm] In function: dutil:csv-escape(xs:string) [698:51:/db/apps/dracor-v0/modules/util.xqm] api:get-corpus-meta-data-csv(item()) [732:3:/db/apps/dracor-v0/modules/api.xqm] api:corpus-meta-data-csv-endpoint(item()) [-1: -1:/db/apps/dracor-v0/modules/api.xqm]

cmil commented 1 year ago

The immediate cause of the problem is that for each play we currently provide two URLs for the digital source, one is an HTML page and there other the actual TEI from Théâtre Classique. See for instance:

https://github.com/dracor-org/fredracor/blob/a9fa55c94986eb5a7c58b099d8e8cae60abe081c/tei/abeille-argelie.xml#L28-L31

This is unexpected in the XQuery and causes the exception.

While this should be caught on the API level, the question remains whether it makes sense to keep these two digital source URLs. I would suggest to loose the reference to the HTML page and just keep the TEI URL, since these are actually the documents we use for the import to FreDraCor. What do you think @lehkost?

cmil commented 1 year ago

@lucagiovannini7 The exception is fixed in version 0.91.1 of the API. We should still fix the TEI.

cmil commented 1 year ago

I created a new issue to take care of the URLs, so we can close this one.