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

knowledgepixels / nanodash / 17263397398

27 Aug 2025 09:52AM UTC coverage: 12.405% (-0.05%) from 12.455%
17263397398

push

github

tkuhn
Support for literal datatypes/language tags in literal placeholders

332 of 3820 branches covered (8.69%)

Branch coverage included in aggregate %.

989 of 6829 relevant lines covered (14.48%)

0.64 hits per line

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

82.35
src/main/java/com/knowledgepixels/nanodash/component/LiteralItem.java
1
package com.knowledgepixels.nanodash.component;
2

3
import org.apache.wicket.markup.html.basic.Label;
4
import org.apache.wicket.markup.html.panel.Panel;
5
import org.eclipse.rdf4j.model.Literal;
6
import org.eclipse.rdf4j.model.Value;
7

8
import com.knowledgepixels.nanodash.component.StatementItem.RepetitionGroup;
9
import com.knowledgepixels.nanodash.template.UnificationException;
10

11
/**
12
 * A component that represents a literal value in the context of a statement.
13
 * It displays the literal's string value and implements the ContextComponent interface
14
 * to allow for unification with other values.
15
 */
16
public class LiteralItem extends Panel implements ContextComponent {
17

18
    private static final long serialVersionUID = 1L;
19

20
    private Literal literal;
21

22
    static final String LABEL_ID = "literal";
23
//        private PublishFormContext context;
24

25
    /**
26
     * Constructor for creating a LiteralItem.
27
     *
28
     * @param id       the Wicket component ID
29
     * @param parentId the ID of the parent component
30
     * @param literal  the literal value to be displayed
31
     * @param rg       the repetition group context
32
     */
33
    public LiteralItem(String id, String parentId, Literal literal, RepetitionGroup rg) {
34
        super(id);
3✔
35
        this.literal = literal;
3✔
36
//                this.context = rg.getContext();
37
        add(new Label(LABEL_ID, literal.stringValue()));
14✔
38
    }
1✔
39

40
    /**
41
     * {@inheritDoc}
42
     */
43
    @Override
44
    public void removeFromContext() {
45
        // Nothing to be done here.
46
    }
×
47

48
    /**
49
     * {@inheritDoc}
50
     */
51
    @Override
52
    public boolean isUnifiableWith(Value v) {
53
        if (!(v instanceof Literal)) return false;
5✔
54
        Literal vL = (Literal) v;
3✔
55
        return vL.equals(literal);
5✔
56
    }
57

58
    /**
59
     * {@inheritDoc}
60
     */
61
    @Override
62
    public void unifyWith(Value v) throws UnificationException {
63
        if (!isUnifiableWith(v)) throw new UnificationException(v.stringValue());
10✔
64
        // Nothing left to be done here.
65
    }
1✔
66

67
    /**
68
     * {@inheritDoc}
69
     */
70
    @Override
71
    public void fillFinished() {
72
    }
×
73

74
    /**
75
     * {@inheritDoc}
76
     */
77
    @Override
78
    public void finalizeValues() {
79
    }
×
80

81
    /**
82
     * Returns a string representation of the LiteralItem.
83
     *
84
     * @return a string describing the literal item
85
     */
86
    public String toString() {
87
        return "[Literal item: " + literal.stringValue() + "]";
5✔
88
    }
89

90
}
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