• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

knowledgepixels / nanodash / 27145358627

08 Jun 2026 02:39PM UTC coverage: 20.682% (-0.3%) from 20.947%
27145358627

push

github

web-flow
Merge pull request #479 from knowledgepixels/feat/about-pages-478

Resource-page tabs, presets, and role-gated view actions (#478, #302)

1052 of 6429 branches covered (16.36%)

Branch coverage included in aggregate %.

2642 of 11432 relevant lines covered (23.11%)

3.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/main/java/com/knowledgepixels/nanodash/component/DownloadRdfLinks.java
1
package com.knowledgepixels.nanodash.component;
2

3
import com.knowledgepixels.nanodash.page.DownloadRdfPage;
4
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
5
import org.apache.wicket.markup.html.panel.Panel;
6
import org.apache.wicket.request.mapper.parameter.PageParameters;
7

8
/**
9
 * A reusable panel that renders the raw page content as RDF download links,
10
 * grouped into "Full nanopublications" and "Assertions only". Used on the Raw
11
 * tab page (and a few list pages) to download all nanopubs on the page. Each
12
 * format has a native-type link and a text/plain link (txt) that always displays
13
 * in the browser.
14
 */
15
public class DownloadRdfLinks extends Panel {
16

17
    /**
18
     * Creates download links for a top-level page (user, space, or resource).
19
     *
20
     * @param markupId the Wicket markup ID
21
     * @param type     "user", "space", or "resource"
22
     * @param id       the resource identifier
23
     */
24
    public DownloadRdfLinks(String markupId, String type, String id) {
25
        this(markupId, type, id, null);
×
26
    }
×
27

28
    /**
29
     * Creates download links for a part page.
30
     *
31
     * @param markupId  the Wicket markup ID
32
     * @param type      "part"
33
     * @param id        the part identifier
34
     * @param contextId the context resource ID (required for type=part)
35
     */
36
    public DownloadRdfLinks(String markupId, String type, String id, String contextId) {
37
        this(markupId, baseParams(type, id, contextId));
×
38
    }
×
39

40
    /**
41
     * Creates download links with arbitrary base parameters (e.g. for list page filters).
42
     *
43
     * @param markupId   the Wicket markup ID
44
     * @param baseParams parameters common to all links (type, id, filters, etc.)
45
     */
46
    public DownloadRdfLinks(String markupId, PageParameters baseParams) {
47
        super(markupId);
×
48

49
        // Full nanopublication links (graph-aware formats)
50
        add(createLink("trig", baseParams, "trig", false, false));
×
51
        add(createLink("trig-txt", baseParams, "trig", true, false));
×
52
        add(createLink("jsonld", baseParams, "jsonld", false, false));
×
53
        add(createLink("jsonld-txt", baseParams, "jsonld", true, false));
×
54
        add(createLink("nq", baseParams, "nq", false, false));
×
55
        add(createLink("nq-txt", baseParams, "nq", true, false));
×
56
        add(createLink("trix", baseParams, "trix", false, false));
×
57
        add(createLink("trix-txt", baseParams, "trix", true, false));
×
58

59
        // Assertions-only links (triple-based formats)
60
        add(createLink("turtle", baseParams, "turtle", false, true));
×
61
        add(createLink("turtle-txt", baseParams, "turtle", true, true));
×
62
        add(createLink("a-jsonld", baseParams, "jsonld", false, true));
×
63
        add(createLink("a-jsonld-txt", baseParams, "jsonld", true, true));
×
64
        add(createLink("nt", baseParams, "nt", false, true));
×
65
        add(createLink("nt-txt", baseParams, "nt", true, true));
×
66
        add(createLink("rdfxml", baseParams, "rdfxml", false, true));
×
67
        add(createLink("rdfxml-txt", baseParams, "rdfxml", true, true));
×
68
    }
×
69

70
    private static PageParameters baseParams(String type, String id, String contextId) {
71
        PageParameters params = new PageParameters()
×
72
                .set("type", type)
×
73
                .set("id", id);
×
74
        if (contextId != null) {
×
75
            params.set("context", contextId);
×
76
        }
77
        return params;
×
78
    }
79

80
    private BookmarkablePageLink<Void> createLink(String wicketId, PageParameters baseParams,
81
            String format, boolean txt, boolean assertionsOnly) {
82
        PageParameters params = new PageParameters(baseParams)
×
83
                .set("format", format);
×
84
        if (txt) {
×
85
            params.set("txt", "");
×
86
        }
87
        if (assertionsOnly) {
×
88
            params.set("assertions", "");
×
89
        }
90
        return new BookmarkablePageLink<>(wicketId, DownloadRdfPage.class, params);
×
91
    }
92

93
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc