eXist-db / AtomicWiki

A wiki based on eXist-db which stores data as Atom feeds
GNU Lesser General Public License v2.1
15 stars 8 forks source link

[BUG] Cardinality error for missing $lang #84

Closed lguariento closed 2 years ago

lguariento commented 2 years ago

This post is not shown and in its place there's a nice cardinality error. Does this happen because the language is missing so that this function complains?

If that's the case, shall we introduce a condition?

lguariento commented 2 years ago

PS: also, a curiosity. Why does the error message say [at line 309, column 36, source: /db/apps/wiki/modules/atomic.xql] when there's not even a line 309 in atomic.xql (the function signature mentioned in the error message is way up)?

Even more curiously, there's some relevant code at, indeed, line 309, although of a different file: store.xql, here. Is this expected behaviour/error messaging?

lguariento commented 2 years ago

This is connected I suppose: https://exist-db.org/exist/apps/wiki/blogs/eXist/?start=46. It happens between 44 and 51.

lguariento commented 2 years ago

Also, I've found a blog without id.

xquery version "3.1";

declare namespace output="http://www.w3.org/2010/xslt-xquery-serialization";
declare namespace wiki="http://exist-db.org/xquery/wiki";
declare namespace atom="http://www.w3.org/2005/Atom";
declare namespace xhtml="http://www.w3.org/1999/xhtml";
declare namespace http="http://expath.org/ns/http-client";

declare option output:method "html5";
declare option output:media-type "text/html";

declare variable $local:WIKI_ROOT := "http://exist-db.org/exist/apps/wiki";

response:set-header("Cache-Control", "no-cache"),

let $start := 13
let $count := 1
let $timelineURLString := "https://exist-db.org/exist/apps/wiki/modules/feeds.xql?feed=eXist&start=" || $start || "&count=" || $count
let $data := http:send-request(
    <http:request method='get' />,$timelineURLString)
  let $entries :=
    for $entry in $data//atom:entry
    let $date := ($entry/atom:updated, $entry/atom:published)[1]
    return $entry//wiki:id

    return $entries

Returns <wiki:id xmlns:wiki="http://exist-db.org/xquery/wiki"/>

It's the eXist-db 5.0.0 RC8. In fact, clicking on its link at the top of the page here doesn't do anything.

lguariento commented 2 years ago

PS: if this is about three separate issues I'll open two other issues.

lguariento commented 2 years ago

This might also be connected: searching for xquery (!!!) returns a cardinality error: https://exist-db.org/exist/apps/wiki/blogs/eXist/search.html?q=xquery . It doesn't get the entry id for building the URI I suppose.

joewiz commented 2 years ago

@lguariento Thanks for opening the issue about language cardinality issues. Further study is needed. Would you like to have a full copy of the app as it is on exist-db.org so you can explore further on your local system?

I fixed the 5.0.0 RC8 error on the server. The problem was an incorrect @src value in <atom:content src=".md"> in the Atom entry for this article at /db/apps/wiki/data/blogs/eXist/eXistdb500RC8.atom. Changing it to eXistdb500RC8.md did the trick.

lguariento commented 2 years ago

Great. Yes, I'd like to have the full set so that I can check things on my own.

I find it ironical that searching for 'xquery' returns a nasty error :) .

lguariento commented 2 years ago

Also, @joewiz , does the issue I fixed the 5.0.0 RC8 you fixed need time to be replicated? I still get the error.

lguariento commented 2 years ago

This is the same issue discussed here. Closing this.