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

knowledgepixels / nanodash / 18155160356

01 Oct 2025 07:42AM UTC coverage: 13.788% (-0.03%) from 13.817%
18155160356

push

github

ashleycaselli
docs: add missing or update Javadoc annotations

445 of 4084 branches covered (10.9%)

Branch coverage included in aggregate %.

1155 of 7520 relevant lines covered (15.36%)

0.69 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/StatementItem.java
1
package com.knowledgepixels.nanodash.component;
2

3
import com.knowledgepixels.nanodash.template.ContextType;
4
import com.knowledgepixels.nanodash.template.Template;
5
import com.knowledgepixels.nanodash.template.TemplateContext;
6
import com.knowledgepixels.nanodash.template.UnificationException;
7
import org.apache.wicket.AttributeModifier;
8
import org.apache.wicket.ajax.AjaxEventBehavior;
9
import org.apache.wicket.ajax.AjaxRequestTarget;
10
import org.apache.wicket.behavior.AttributeAppender;
11
import org.apache.wicket.markup.html.WebMarkupContainer;
12
import org.apache.wicket.markup.html.basic.Label;
13
import org.apache.wicket.markup.html.list.ListItem;
14
import org.apache.wicket.markup.html.list.ListView;
15
import org.apache.wicket.markup.html.panel.Panel;
16
import org.apache.wicket.model.IModel;
17
import org.eclipse.rdf4j.model.IRI;
18
import org.eclipse.rdf4j.model.Statement;
19
import org.eclipse.rdf4j.model.Value;
20
import org.eclipse.rdf4j.model.ValueFactory;
21
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
22
import org.nanopub.MalformedNanopubException;
23
import org.nanopub.NanopubAlreadyFinalizedException;
24
import org.nanopub.NanopubCreator;
25
import org.nanopub.vocabulary.NTEMPLATE;
26
import org.slf4j.Logger;
27
import org.slf4j.LoggerFactory;
28

29
import java.io.Serializable;
30
import java.util.*;
31

32
/**
33
 * Represents a single item in a statement, which can be a subject, predicate, or object.
34
 */
35
public class StatementItem extends Panel {
36

37
    private TemplateContext context;
38
    private IRI statementId;
39
    private List<IRI> statementPartIds = new ArrayList<>();
×
40
    private List<WebMarkupContainer> viewElements = new ArrayList<>();
×
41
    private List<RepetitionGroup> repetitionGroups = new ArrayList<>();
×
42
    private boolean repetitionGroupsChanged = true;
×
43
    private Set<IRI> iriSet = new HashSet<>();
×
44
    private boolean isMatched = false;
×
45
    private static final Logger logger = LoggerFactory.getLogger(StatementItem.class);
×
46

47
    /**
48
     * Constructor for creating a StatementItem with a specific ID and statement ID.
49
     *
50
     * @param id          the Wicket component ID
51
     * @param statementId the IRI of the statement this item represents
52
     * @param context     the template context containing information about the template and its items
53
     */
54
    public StatementItem(String id, IRI statementId, TemplateContext context) {
55
        super(id);
×
56

57
        this.statementId = statementId;
×
58
        this.context = context;
×
59
        setOutputMarkupId(true);
×
60

61
        if (isGrouped()) {
×
62
            statementPartIds.addAll(getTemplate().getStatementIris(statementId));
×
63
        } else {
64
            statementPartIds.add(statementId);
×
65
        }
66

67
        addRepetitionGroup();
×
68

69
        ListView<WebMarkupContainer> v = new ListView<WebMarkupContainer>("statement-group", viewElements) {
×
70

71
            @Override
72
            protected void populateItem(ListItem<WebMarkupContainer> item) {
73
                item.add(item.getModelObject());
×
74
            }
×
75

76
        };
77
        v.setOutputMarkupId(true);
×
78
        add(v);
×
79
    }
×
80

81
    /**
82
     * Adds a new repetition group to this StatementItem with a default RepetitionGroup.
83
     */
84
    public void addRepetitionGroup() {
85
        addRepetitionGroup(new RepetitionGroup());
×
86
    }
×
87

88
    /**
89
     * Adds a new repetition group to this StatementItem.
90
     *
91
     * @param rg the RepetitionGroup to add
92
     */
93
    public void addRepetitionGroup(RepetitionGroup rg) {
94
        repetitionGroups.add(rg);
×
95
        repetitionGroupsChanged = true;
×
96
    }
×
97

98
    /**
99
     * {@inheritDoc}
100
     */
101
    @Override
102
    protected void onBeforeRender() {
103
        if (repetitionGroupsChanged) {
×
104
            updateViewElements();
×
105
            finalizeValues();
×
106
        }
107
        repetitionGroupsChanged = false;
×
108
        super.onBeforeRender();
×
109
    }
×
110

111
    private void updateViewElements() {
112
        viewElements.clear();
×
113
        boolean first = true;
×
114
        for (RepetitionGroup r : repetitionGroups) {
×
115
            if (isGrouped() && !first) {
×
116
                viewElements.add(new HorizontalLine("statement"));
×
117
            }
118
            viewElements.addAll(r.getStatementParts());
×
119
            boolean isOnly = repetitionGroups.size() == 1;
×
120
            boolean isLast = repetitionGroups.get(repetitionGroups.size() - 1) == r;
×
121
            r.addRepetitionButton.setVisible(!context.isReadOnly() && isRepeatable() && isLast);
×
122
            r.removeRepetitionButton.setVisible(!context.isReadOnly() && isRepeatable() && !isOnly);
×
123
            r.optionalMark.setVisible(isOnly);
×
124
            first = false;
×
125
        }
×
126
        String htmlClassString = "";
×
127
        if (!context.isReadOnly() && isOptional()) {
×
128
            htmlClassString += "nanopub-optional ";
×
129
        }
130
        boolean singleItem = context.getStatementItems().size() == 1;
×
131
        boolean repeatableOrRepeated = (!context.isReadOnly() && isRepeatable()) || (context.isReadOnly() && getRepetitionCount() > 1);
×
132
        if ((isGrouped() || repeatableOrRepeated) && !singleItem) {
×
133
            htmlClassString += "nanopub-group ";
×
134
        }
135
        if (!htmlClassString.isEmpty()) {
×
136
            add(new AttributeModifier("class", htmlClassString));
×
137
        }
138
    }
×
139

140
    /**
141
     * Adds the triples of this statement item to the given NanopubCreator.
142
     *
143
     * @param npCreator the NanopubCreator to which the triples will be added
144
     * @throws org.nanopub.MalformedNanopubException        if the statement item is not properly set up
145
     * @throws org.nanopub.NanopubAlreadyFinalizedException if the NanopubCreator has already been finalized
146
     */
147
    public void addTriplesTo(NanopubCreator npCreator) throws MalformedNanopubException, NanopubAlreadyFinalizedException {
148
        if (hasEmptyElements()) {
×
149
            if (isOptional()) {
×
150
                return;
×
151
            } else {
152
                throw new MalformedNanopubException("Field of statement not set.");
×
153
            }
154
        }
155
        for (RepetitionGroup rg : repetitionGroups) {
×
156
            rg.addTriplesTo(npCreator);
×
157
        }
×
158
    }
×
159

160
    private Template getTemplate() {
161
        return context.getTemplate();
×
162
    }
163

164
    /**
165
     * Returns the number of the repetition groups for this statement item.
166
     *
167
     * @return the number of repetition groups
168
     */
169
    public int getRepetitionCount() {
170
        return repetitionGroups.size();
×
171
    }
172

173
    /**
174
     * Returns the IRI of the statement this item represents.
175
     *
176
     * @return the statement ID
177
     */
178
    public boolean isOptional() {
179
        return repetitionGroups.size() == 1 && getTemplate().isOptionalStatement(statementId);
×
180
    }
181

182
    /**
183
     * Checks if this statement item is grouped.
184
     *
185
     * @return true if the statement item is grouped, false otherwise
186
     */
187
    public boolean isGrouped() {
188
        return getTemplate().isGroupedStatement(statementId);
×
189
    }
190

191
    /**
192
     * Checks if this statement item is repeatable.
193
     *
194
     * @return true if the statement item is repeatable, false otherwise
195
     */
196
    public boolean isRepeatable() {
197
        return getTemplate().isRepeatableStatement(statementId);
×
198
    }
199

200
    /**
201
     * Checks if this statement item has empty elements.
202
     *
203
     * @return true if any of the repetition groups has empty elements, false otherwise
204
     */
205
    public boolean hasEmptyElements() {
206
        return repetitionGroups.get(0).hasEmptyElements();
×
207
    }
208

209
    /**
210
     * Returns the set of IRIs associated with this statement item.
211
     *
212
     * @return a set of IRIs
213
     */
214
    public Set<IRI> getIriSet() {
215
        return iriSet;
×
216
    }
217

218
    /**
219
     * Checks if this statement item will match any triple.
220
     *
221
     * @return true if it will match any triple, false otherwise
222
     */
223
    public boolean willMatchAnyTriple() {
224
        return repetitionGroups.get(0).matches(dummyStatementList);
×
225
    }
226

227
    /**
228
     * Fills this statement item with the provided list of statements, matching them against the repetition groups.
229
     *
230
     * @param statements the list of statements to match against
231
     * @throws com.knowledgepixels.nanodash.template.UnificationException if the statements cannot be unified with this statement item
232
     */
233
    public void fill(List<Statement> statements) throws UnificationException {
234
        if (isMatched) return;
×
235
        if (repetitionGroups.size() == 1) {
×
236
            RepetitionGroup rg = repetitionGroups.get(0);
×
237
            if (rg.matches(statements)) {
×
238
                rg.fill(statements);
×
239
            } else {
240
                return;
×
241
            }
242
        } else {
×
243
            return;
×
244
        }
245
        isMatched = true;
×
246
        if (!isRepeatable()) return;
×
247
        while (true) {
248
            RepetitionGroup newGroup = new RepetitionGroup();
×
249
            if (newGroup.matches(statements)) {
×
250
                newGroup.fill(statements);
×
251
                addRepetitionGroup(newGroup);
×
252
            } else {
253
                newGroup.disconnect();
×
254
                return;
×
255
            }
256
        }
×
257
    }
258

259
    /**
260
     * Marks the filling of this statement item as finished, indicating that all values have been filled.
261
     */
262
    public void fillFinished() {
263
        for (RepetitionGroup rg : repetitionGroups) {
×
264
            rg.fillFinished();
×
265
        }
×
266
    }
×
267

268
    /**
269
     * Finalizes the values of all ValueItems in this statement item.
270
     */
271
    public void finalizeValues() {
272
        for (RepetitionGroup rg : repetitionGroups) {
×
273
            rg.finalizeValues();
×
274
        }
×
275
    }
×
276

277
    /**
278
     * Returns true if the statement item has been matched with a set of statements.
279
     *
280
     * @return true if matched, false otherwise
281
     */
282
    public boolean isMatched() {
283
        return isMatched;
×
284
    }
285

286
    /**
287
     * Checks if this statement item is empty, meaning it has no filled repetition groups.
288
     *
289
     * @return true if the statement item is empty, false otherwise
290
     */
291
    public boolean isEmpty() {
292
        return repetitionGroups.size() == 1 && repetitionGroups.get(0).isEmpty();
×
293
    }
294

295
    /**
296
     * Represents a group of repetitions for a statement item, containing multiple statement parts.
297
     */
298
    public class RepetitionGroup implements Serializable {
299

300
        private List<StatementPartItem> statementParts;
301
        private List<ValueItem> localItems = new ArrayList<>();
×
302
        private boolean filled = false;
×
303

304
        private List<ValueItem> items = new ArrayList<>();
×
305

306
        Label addRepetitionButton, removeRepetitionButton, optionalMark;
307

308
        /**
309
         * Constructor for creating a RepetitionGroup.
310
         */
311
        public RepetitionGroup() {
×
312
            statementParts = new ArrayList<>();
×
313
            for (IRI s : statementPartIds) {
×
314
                StatementPartItem statement = new StatementPartItem("statement",
×
315
                        makeValueItem("subj", getTemplate().getSubject(s), s),
×
316
                        makeValueItem("pred", getTemplate().getPredicate(s), s),
×
317
                        makeValueItem("obj", getTemplate().getObject(s), s)
×
318
                );
319
                statementParts.add(statement);
×
320

321
                // Some of the methods of StatementItem and RepetitionGroup don't work properly before this
322
                // object is fully instantiated:
323
                boolean isFirstGroup = repetitionGroups.isEmpty();
×
324
                boolean isFirstLine = statementParts.size() == 1;
×
325
                boolean isLastLine = statementParts.size() == statementPartIds.size();
×
326
                boolean isOptional = getTemplate().isOptionalStatement(statementId);
×
327

328
                if (statementParts.size() == 1 && !isFirstGroup) {
×
329
                    statement.add(new AttributeAppender("class", " separate-statement"));
×
330
                }
331
                if (!context.isReadOnly() && isOptional && isLastLine) {
×
332
                    optionalMark = new Label("label", "(optional)");
×
333
                } else {
334
                    optionalMark = new Label("label", "");
×
335
                    optionalMark.setVisible(false);
×
336
                }
337
                statement.add(optionalMark);
×
338
                if (isLastLine) {
×
339
                    addRepetitionButton = new Label("add-repetition", "+");
×
340
                    statement.add(addRepetitionButton);
×
341
                    addRepetitionButton.add(new AjaxEventBehavior("click") {
×
342

343
                        @Override
344
                        protected void onEvent(AjaxRequestTarget target) {
345
                            addRepetitionGroup(new RepetitionGroup());
×
346
                            target.add(StatementItem.this);
×
347
                            target.appendJavaScript("updateElements();");
×
348
                        }
×
349

350
                    });
351
                } else {
352
                    statement.add(new Label("add-repetition", "").setVisible(false));
×
353
                }
354
                if (isFirstLine) {
×
355
                    removeRepetitionButton = new Label("remove-repetition", "-");
×
356
                    statement.add(removeRepetitionButton);
×
357
                    removeRepetitionButton.add(new AjaxEventBehavior("click") {
×
358

359
                        @Override
360
                        protected void onEvent(AjaxRequestTarget target) {
361
                            RepetitionGroup.this.remove();
×
362
                            target.appendJavaScript("updateElements();");
×
363
                            target.add(StatementItem.this);
×
364
                        }
×
365

366
                    });
367
                } else {
368
                    statement.add(new Label("remove-repetition", "").setVisible(false));
×
369
                }
370
            }
×
371
        }
×
372

373
        private ValueItem makeValueItem(String id, Value value, IRI statementPartId) {
374
            if (isFirst() && value instanceof IRI) {
×
375
                iriSet.add((IRI) value);
×
376
            }
377
            ValueItem vi = new ValueItem(id, transform(value), statementPartId, this);
×
378
            localItems.add(vi);
×
379
            items.add(vi);
×
380
            return vi;
×
381
        }
382

383
        private void disconnect() {
384
            for (ValueItem vi : new ArrayList<>(localItems)) {
×
385
                // TODO These remove operations on list are slow. Improve:
386
                localItems.remove(vi);
×
387
                items.remove(vi);
×
388
                vi.removeFromContext();
×
389
            }
×
390
        }
×
391

392
        /**
393
         * Returns the statement parts.
394
         *
395
         * @return a list of StatementPartItem objects representing the statement parts
396
         */
397
        public List<StatementPartItem> getStatementParts() {
398
            return statementParts;
×
399
        }
400

401
        /**
402
         * Returns the index of this repetition group in the list of repetition groups.
403
         *
404
         * @return the index of this repetition group
405
         */
406
        public int getRepeatIndex() {
407
            if (!repetitionGroups.contains(this)) return repetitionGroups.size();
×
408
            return repetitionGroups.indexOf(this);
×
409
        }
410

411
        /**
412
         * Returns true if the repeat index if the first one.
413
         *
414
         * @return true if the repeat index is 0, false otherwise
415
         */
416
        public boolean isFirst() {
417
            return getRepeatIndex() == 0;
×
418
        }
419

420
        /**
421
         * Returns true if the repeat index is the last one.
422
         *
423
         * @return true if the repeat index is the last one, false otherwise
424
         */
425
        public boolean isLast() {
426
            return getRepeatIndex() == repetitionGroups.size() - 1;
×
427
        }
428

429
        private void remove() {
430
            String thisSuffix = getRepeatSuffix();
×
431
            for (IRI iriBase : iriSet) {
×
432
                IRI thisIri = vf.createIRI(iriBase + thisSuffix);
×
433
                if (context.getComponentModels().containsKey(thisIri)) {
×
434
                    IModel<String> swapModel1 = context.getComponentModels().get(thisIri);
×
435
                    for (int i = getRepeatIndex() + 1; i < repetitionGroups.size(); i++) {
×
436
                        IModel<String> swapModel2 = context.getComponentModels().get(vf.createIRI(iriBase + getRepeatSuffix(i)));
×
437
                        if (swapModel1 != null && swapModel2 != null) {
×
438
                            swapModel1.setObject(swapModel2.getObject());
×
439
                        }
440
                        swapModel1 = swapModel2;
×
441
                    }
442
                    // Clear last object:
443
                    if (swapModel1 != null) swapModel1.setObject("");
×
444
                }
445
            }
×
446
            RepetitionGroup lastGroup = repetitionGroups.get(repetitionGroups.size() - 1);
×
447
            repetitionGroups.remove(lastGroup);
×
448
            for (ValueItem vi : lastGroup.items) {
×
449
                vi.removeFromContext();
×
450
            }
×
451
            repetitionGroupsChanged = true;
×
452
        }
×
453

454
        private String getRepeatSuffix() {
455
            return getRepeatSuffix(getRepeatIndex());
×
456
        }
457

458
        private String getRepeatSuffix(int i) {
459
            if (i == 0) return "";
×
460
            // TODO: Check that this double-underscore pattern isn't used otherwise:
461
            return "__" + i;
×
462
        }
463

464
        /**
465
         * Returns the template context associated.
466
         *
467
         * @return the TemplateContext
468
         */
469
        public TemplateContext getContext() {
470
            return context;
×
471
        }
472

473
        /**
474
         * Checks if this repetition group is optional.
475
         *
476
         * @return true if the repetition group is optional, false otherwise
477
         */
478
        public boolean isOptional() {
479
            if (!getTemplate().isOptionalStatement(statementId)) return false;
×
480
            if (repetitionGroups.size() == 0) return true;
×
481
            if (repetitionGroups.size() == 1 && repetitionGroups.get(0) == this) return true;
×
482
            return false;
×
483
        }
484

485
        private Value transform(Value value) {
486
            if (!(value instanceof IRI)) {
×
487
                return value;
×
488
            }
489
            IRI iri = (IRI) value;
×
490
            String iriString = iri.stringValue();
×
491
            iriString = iriString.replaceAll("~~ARTIFACTCODE~~", "~~~ARTIFACTCODE~~~");
×
492
            // Only add "__N" to URI from second repetition group on; for the first group, information about
493
            // narrow scopes is not yet complete.
494
            if (getRepeatIndex() > 0 && context.hasNarrowScope(iri)) {
×
495
                if (context.getTemplate().isPlaceholder(iri) || context.getTemplate().isLocalResource(iri)) {
×
496
                    iriString += getRepeatSuffix();
×
497
                }
498
            }
499
            return vf.createIRI(iriString);
×
500
        }
501

502
        /**
503
         * Adds the triples of this repetition group to the given NanopubCreator.
504
         *
505
         * @param npCreator the NanopubCreator to which the triples will be added
506
         * @throws org.nanopub.NanopubAlreadyFinalizedException if the NanopubCreator has already been finalized
507
         */
508
        public void addTriplesTo(NanopubCreator npCreator) throws NanopubAlreadyFinalizedException {
509
            Template t = getTemplate();
×
510
            for (IRI s : statementPartIds) {
×
511
                IRI subj = context.processIri((IRI) transform(t.getSubject(s)));
×
512
                IRI pred = context.processIri((IRI) transform(t.getPredicate(s)));
×
513
                Value obj = context.processValue(transform(t.getObject(s)));
×
514
                if (context.getType() == ContextType.ASSERTION) {
×
515
                    npCreator.addAssertionStatement(subj, pred, obj);
×
516
                } else if (context.getType() == ContextType.PROVENANCE) {
×
517
                    npCreator.addProvenanceStatement(subj, pred, obj);
×
518
                } else if (context.getType() == ContextType.PUBINFO) {
×
519
                    npCreator.addPubinfoStatement(subj, pred, obj);
×
520
                }
521
            }
×
522
            for (ValueItem vi : items) {
×
523
                if (vi.getComponent() instanceof GuidedChoiceItem) {
×
524
                    String value = ((GuidedChoiceItem) vi.getComponent()).getModel().getObject();
×
525
                    if (value != null && GuidedChoiceItem.getLabel(value) != null) {
×
526
                        String label = GuidedChoiceItem.getLabel(value);
×
527
                        if (label.length() > 1000) label = label.substring(0, 997) + "...";
×
528
                        try {
529
                            npCreator.addPubinfoStatement(vf.createIRI(value), NTEMPLATE.HAS_LABEL_FROM_API, vf.createLiteral(label));
×
530
                        } catch (IllegalArgumentException ex) {
×
531
                            logger.error("Could not create IRI from value: {}", value, ex);
×
532
                        }
×
533
                    }
534
                }
535
            }
×
536
        }
×
537

538
        private boolean hasEmptyElements() {
539
            for (IRI s : statementPartIds) {
×
540
                if (context.processIri((IRI) transform(getTemplate().getSubject(s))) == null) return true;
×
541
                if (context.processIri((IRI) transform(getTemplate().getPredicate(s))) == null) return true;
×
542
                if (context.processValue(transform(getTemplate().getObject(s))) == null) return true;
×
543
            }
×
544
            return false;
×
545
        }
546

547
        /**
548
         * Checks if this repetition group is empty, meaning it has no filled items.
549
         *
550
         * @return true if the repetition group is empty, false otherwise
551
         */
552
        public boolean isEmpty() {
553
            for (IRI s : statementPartIds) {
×
554
                Template t = getTemplate();
×
555
                IRI subj = t.getSubject(s);
×
556
                if (t.isPlaceholder(subj) && context.hasNarrowScope(subj) && context.processIri((IRI) transform(subj)) != null)
×
557
                    return false;
×
558
                IRI pred = t.getPredicate(s);
×
559
                if (t.isPlaceholder(pred) && context.hasNarrowScope(pred) && context.processIri((IRI) transform(pred)) != null)
×
560
                    return false;
×
561
                Value obj = t.getObject(s);
×
562
                if (obj instanceof IRI && t.isPlaceholder((IRI) obj) && context.hasNarrowScope((IRI) obj) && context.processValue(transform(obj)) != null)
×
563
                    return false;
×
564
            }
×
565
            return true;
×
566
        }
567

568
        /**
569
         * Checks if this repetition group matches the provided list of statements.
570
         *
571
         * @param statements the list of statements to match against
572
         * @return true if the repetition group matches, false otherwise
573
         */
574
        public boolean matches(List<Statement> statements) {
575
            if (filled) return false;
×
576
            List<Statement> st = new ArrayList<>(statements);
×
577
            for (StatementPartItem p : statementParts) {
×
578
                Statement matchedStatement = null;
×
579
                for (Statement s : st) {
×
580
                    if (
×
581
                            p.getPredicate().isUnifiableWith(s.getPredicate()) &&  // checking predicate first optimizes performance
×
582
                            p.getSubject().isUnifiableWith(s.getSubject()) &&
×
583
                            p.getObject().isUnifiableWith(s.getObject())) {
×
584
                        matchedStatement = s;
×
585
                        break;
×
586
                    }
587
                }
×
588
                if (matchedStatement == null) {
×
589
                    return false;
×
590
                } else {
591
                    st.remove(matchedStatement);
×
592
                }
593
            }
×
594
            return true;
×
595
        }
596

597
        /**
598
         * Fills this repetition group with the provided list of statements, unifying them with the statement parts.
599
         *
600
         * @param statements the list of statements to match against
601
         * @throws UnificationException if the statements cannot be unified with this repetition group
602
         */
603
        public void fill(List<Statement> statements) throws UnificationException {
604
            if (filled) throw new UnificationException("Already filled");
×
605
            for (StatementPartItem p : statementParts) {
×
606
                Statement matchedStatement = null;
×
607
                for (Statement s : statements) {
×
608
                    if (
×
609
                            p.getPredicate().isUnifiableWith(s.getPredicate()) &&  // checking predicate first optimizes performance
×
610
                            p.getSubject().isUnifiableWith(s.getSubject()) &&
×
611
                            p.getObject().isUnifiableWith(s.getObject())) {
×
612
                        p.getPredicate().unifyWith(s.getPredicate());
×
613
                        p.getSubject().unifyWith(s.getSubject());
×
614
                        p.getObject().unifyWith(s.getObject());
×
615
                        matchedStatement = s;
×
616
                        break;
×
617
                    }
618
                }
×
619
                if (matchedStatement == null) {
×
620
                    throw new UnificationException("Unification seemed to work but then didn't");
×
621
                } else {
622
                    statements.remove(matchedStatement);
×
623
                }
624
                filled = true;
×
625
            }
×
626
        }
×
627

628
        /**
629
         * Marks the filling of this repetition group as finished, indicating that all values have been filled.
630
         */
631
        public void fillFinished() {
632
            for (ValueItem vi : items) {
×
633
                vi.fillFinished();
×
634
            }
×
635
        }
×
636

637
        /**
638
         * Finalizes the values of all ValueItems in this repetition group.
639
         */
640
        public void finalizeValues() {
641
            for (ValueItem vi : items) {
×
642
                vi.finalizeValues();
×
643
            }
×
644
        }
×
645

646
    }
647

648
    private static final ValueFactory vf = SimpleValueFactory.getInstance();
×
649
    private static final List<Statement> dummyStatementList = new ArrayList<Statement>(Arrays.asList(vf.createStatement(vf.createIRI("http://dummy.com/"), vf.createIRI("http://dummy.com/"), vf.createIRI("http://dummy.com/"))));
×
650

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