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

knowledgepixels / nanodash / 19097758229

05 Nov 2025 09:43AM UTC coverage: 14.319% (-0.6%) from 14.966%
19097758229

push

github

tkuhn
feat: Add ViewDisplay class to link source nanopub for QueryResultTable

518 of 4516 branches covered (11.47%)

Branch coverage included in aggregate %.

1332 of 8404 relevant lines covered (15.85%)

0.71 hits per line

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

35.96
src/main/java/com/knowledgepixels/nanodash/Space.java
1
package com.knowledgepixels.nanodash;
2

3
import static com.knowledgepixels.nanodash.Utils.vf;
4

5
import java.io.Serializable;
6
import java.util.ArrayList;
7
import java.util.Calendar;
8
import java.util.Collections;
9
import java.util.HashMap;
10
import java.util.HashSet;
11
import java.util.List;
12
import java.util.Map;
13
import java.util.Set;
14

15
import org.eclipse.rdf4j.model.IRI;
16
import org.eclipse.rdf4j.model.Literal;
17
import org.eclipse.rdf4j.model.Statement;
18
import org.eclipse.rdf4j.model.vocabulary.DCTERMS;
19
import org.eclipse.rdf4j.model.vocabulary.OWL;
20
import org.nanopub.Nanopub;
21
import org.nanopub.extra.services.ApiResponse;
22
import org.nanopub.extra.services.ApiResponseEntry;
23
import org.nanopub.extra.services.QueryRef;
24
import org.nanopub.vocabulary.NTEMPLATE;
25
import org.slf4j.Logger;
26
import org.slf4j.LoggerFactory;
27

28
import com.github.jsonldjava.shaded.com.google.common.collect.Ordering;
29
import com.google.common.collect.ArrayListMultimap;
30
import com.google.common.collect.Multimap;
31
import com.knowledgepixels.nanodash.template.Template;
32
import com.knowledgepixels.nanodash.template.TemplateData;
33

34
import jakarta.xml.bind.DatatypeConverter;
35

36
/**
37
 * Class representing a "Space", which can be any kind of collaborative unit, like a project, group, or event.
38
 */
39
public class Space implements Serializable {
40

41
    private static final Logger logger = LoggerFactory.getLogger(Space.class);
3✔
42

43
    /**
44
     * The predicate to assign the admins of the space.
45
     */
46
    public static final IRI HAS_ADMIN = vf.createIRI("https://w3id.org/kpxl/gen/terms/hasAdmin");
4✔
47

48
    /**
49
     * The predicate for pinned templates in the space.
50
     */
51
    public static final IRI HAS_PINNED_TEMPLATE = vf.createIRI("https://w3id.org/kpxl/gen/terms/hasPinnedTemplate");
4✔
52

53
    /**
54
     * The predicate for pinned queries in the space.
55
     */
56
    public static final IRI HAS_PINNED_QUERY = vf.createIRI("https://w3id.org/kpxl/gen/terms/hasPinnedQuery");
4✔
57

58
    private static List<Space> spaceList;
59
    private static Map<String, List<Space>> spaceListByType;
60
    private static Map<String, Space> spacesByCoreInfo = new HashMap<>();
4✔
61
    private static Map<String, Space> spacesById;
62
    private static Map<Space, Set<Space>> subspaceMap;
63
    private static Map<Space, Set<Space>> superspaceMap;
64
    private static boolean loaded = false;
3✔
65

66
    /**
67
     * Refresh the list of spaces from the API response.
68
     *
69
     * @param resp The API response containing space data.
70
     */
71
    public static synchronized void refresh(ApiResponse resp) {
72
        spaceList = new ArrayList<>();
4✔
73
        spaceListByType = new HashMap<>();
4✔
74
        Map<String, Space> prevSpacesByCoreInfoPrev = spacesByCoreInfo;
2✔
75
        spacesByCoreInfo = new HashMap<>();
4✔
76
        spacesById = new HashMap<>();
4✔
77
        subspaceMap = new HashMap<>();
4✔
78
        superspaceMap = new HashMap<>();
4✔
79
        for (ApiResponseEntry entry : resp.getData()) {
11✔
80
            Space space = new Space(entry);
5✔
81
            Space prevSpace = prevSpacesByCoreInfoPrev.get(space.getCoreInfoString());
6✔
82
            if (prevSpace != null) space = prevSpace;
4✔
83
            spaceList.add(space);
4✔
84
            spaceListByType.computeIfAbsent(space.getType(), k -> new ArrayList<>()).add(space);
13✔
85
            spacesByCoreInfo.put(space.getCoreInfoString(), space);
6✔
86
            spacesById.put(space.getId(), space);
6✔
87
        }
1✔
88
        for (Space space : spaceList) {
10✔
89
            Space superSpace = space.getIdSuperspace();
3✔
90
            if (superSpace == null) continue;
3✔
91
            subspaceMap.computeIfAbsent(superSpace, k -> new HashSet<>()).add(space);
12✔
92
            superspaceMap.computeIfAbsent(space, k -> new HashSet<>()).add(superSpace);
12✔
93
        }
1✔
94
        loaded = true;
2✔
95
    }
1✔
96

97
    /**
98
     * Check if the spaces have been loaded.
99
     *
100
     * @return true if loaded, false otherwise.
101
     */
102
    public static boolean isLoaded() {
103
        return loaded;
×
104
    }
105

106
    public static boolean areAllSpacesInitialized() {
107
        for (Space space : spaceList) {
×
108
            if (!space.isDataInitialized()) return false;
×
109
        }
×
110
        return true;
×
111
    }
112

113
    public static void triggerAllDataUpdates() {
114
        for (Space space : spaceList) {
×
115
            space.triggerDataUpdate();
×
116
        }
×
117
    }
×
118

119
    /**
120
     * Ensure that the spaces are loaded, fetching them from the API if necessary.
121
     */
122
    public static void ensureLoaded() {
123
        if (spaceList == null) {
2✔
124
            refresh(QueryApiAccess.forcedGet(new QueryRef("get-spaces")));
6✔
125
        }
126
    }
1✔
127

128
    /**
129
     * Get the list of all spaces.
130
     *
131
     * @return List of spaces.
132
     */
133
    public static List<Space> getSpaceList() {
134
        ensureLoaded();
×
135
        return spaceList;
×
136
    }
137

138
    /**
139
     * Get the list of spaces of a specific type.
140
     *
141
     * @param type The type of spaces to retrieve.
142
        System.err.println("REFRESH...");
143
     * @return List of spaces of the specified type.
144
     */
145
    public static List<Space> getSpaceList(String type) {
146
        ensureLoaded();
×
147
        return spaceListByType.computeIfAbsent(type, k -> new ArrayList<>());
×
148
    }
149

150
    /**
151
     * Get a space by its id.
152
     *
153
     * @param id The id of the space.
154
     * @return The corresponding Space object, or null if not found.
155
     */
156
    public static Space get(String id) {
157
        ensureLoaded();
1✔
158
        return spacesById.get(id);
5✔
159
    }
160

161
    /**
162
     * Mark all spaces as needing a data update.
163
     */
164
    public static void refresh() {
165
        refresh(QueryApiAccess.forcedGet(new QueryRef("get-spaces")));
6✔
166
        for (Space space : spaceList) {
10✔
167
            space.dataNeedsUpdate = true;
3✔
168
        }
1✔
169
    }
1✔
170

171
    private String id, label, rootNanopubId, type;
172
    private Nanopub rootNanopub = null;
3✔
173
    private SpaceData data = new SpaceData();
5✔
174

175
    private static class SpaceData implements Serializable {
2✔
176

177
        List<String> altIds = new ArrayList<>();
5✔
178

179
        String description = null;
3✔
180
        Calendar startDate, endDate;
181
        IRI defaultProvenance = null;
3✔
182

183
        List<IRI> admins = new ArrayList<>();
5✔
184
        Map<IRI, Set<SpaceMemberRole>> users = new HashMap<>();
5✔
185
        List<SpaceMemberRole> roles = new ArrayList<>();
5✔
186
        Map<IRI, SpaceMemberRole> roleMap = new HashMap<>();
5✔
187

188
        Map<String, IRI> adminPubkeyMap = new HashMap<>();
5✔
189
        Set<Serializable> pinnedResources = new HashSet<>();
5✔
190
        List<ViewDisplay> viewDisplays = new ArrayList<>();
5✔
191
        Set<String> pinGroupTags = new HashSet<>();
5✔
192
        Map<String, Set<Serializable>> pinnedResourceMap = new HashMap<>();
6✔
193

194
        void addAdmin(IRI admin) {
195
            // TODO This isn't efficient for long owner lists:
196
            if (admins.contains(admin)) return;
5!
197
            admins.add(admin);
5✔
198
            UserData ud = User.getUserData();
2✔
199
            for (String pubkeyhash : ud.getPubkeyhashes(admin, true)) {
14✔
200
                adminPubkeyMap.put(pubkeyhash, admin);
6✔
201
            }
1✔
202
            users.computeIfAbsent(admin, (k) -> new HashSet<>()).add(SpaceMemberRole.ADMIN_ROLE);
13✔
203
        }
1✔
204

205
    }
206

207
    private boolean dataInitialized = false;
3✔
208
    private boolean dataNeedsUpdate = true;
3✔
209

210
    private Space(ApiResponseEntry resp) {
2✔
211
        this.id = resp.get("space");
5✔
212
        this.label = resp.get("label");
5✔
213
        this.type = resp.get("type");
5✔
214
        this.rootNanopubId = resp.get("np");
5✔
215
        this.rootNanopub = Utils.getAsNanopub(rootNanopubId);
5✔
216
        setCoreData(data);
4✔
217
    }
1✔
218

219
    /**
220
     * Get the ID of the space.
221
     *
222
     * @return The space ID.
223
     */
224
    public String getId() {
225
        return id;
3✔
226
    }
227

228
    /**
229
     * Get the root nanopublication ID of the space.
230
     *
231
     * @return The root nanopub ID.
232
     */
233
    public String getRootNanopubId() {
234
        return rootNanopubId;
×
235
    }
236

237
    /**
238
     * Get a string combining the space ID and root nanopub ID for core identification.
239
     *
240
     * @return The core info string.
241
     */
242
    public String getCoreInfoString() {
243
        return id + " " + rootNanopubId;
6✔
244
    }
245

246
    /**
247
     * Get the root nanopublication of the space.
248
     *
249
     * @return The root Nanopub object.
250
     */
251
    public Nanopub getRootNanopub() {
252
        return rootNanopub;
×
253
    }
254

255
    /**
256
     * Get the label of the space.
257
     *
258
     * @return The space label.
259
     */
260
    public String getLabel() {
261
        return label;
×
262
    }
263

264
    /**
265
     * Get the type of the space.
266
     *
267
     * @return The space type.
268
     */
269
    public String getType() {
270
        return type;
3✔
271
    }
272

273
    /**
274
     * Get the start date of the space.
275
     *
276
     * @return The start date as a Calendar object, or null if not set.
277
     */
278
    public Calendar getStartDate() {
279
        return data.startDate;
×
280
    }
281

282
    /**
283
     * Get the end date of the space.
284
     *
285
     * @return The end date as a Calendar object, or null if not set.
286
     */
287
    public Calendar getEndDate() {
288
        return data.endDate;
×
289
    }
290

291
    /**
292
     * Get a simplified label for the type of space by removing any namespace prefix.
293
     *
294
     * @return The simplified type label.
295
     */
296
    public String getTypeLabel() {
297
        return type.replaceFirst("^.*/", "");
×
298
    }
299

300
    /**
301
     * Get the description of the space.
302
     *
303
     * @return The description string.
304
     */
305
    public String getDescription() {
306
        return data.description;
×
307
    }
308

309
    /**
310
     * Check if the space data has been initialized.
311
     *
312
     * @return true if initialized, false otherwise.
313
     */
314
    public boolean isDataInitialized() {
315
        triggerDataUpdate();
×
316
        return dataInitialized;
×
317
    }
318

319
    /**
320
     * Get the list of admins in this space.
321
     *
322
     * @return List of admin IRIs.
323
     */
324
    public List<IRI> getAdmins() {
325
        ensureInitialized();
×
326
        return data.admins;
×
327
    }
328

329
    /**
330
     * Get the list of members in this space.
331
     *
332
     * @return List of member IRIs.
333
     */
334
    public List<IRI> getUsers() {
335
        ensureInitialized();
×
336
        List<IRI> users = new ArrayList<IRI>(data.users.keySet());
×
337
        users.sort(User.getUserData().userComparator);
×
338
        return users;
×
339
    }
340

341
    /**
342
     * Get the roles of a specific member in this space.
343
     *
344
     * @param userId The IRI of the member.
345
     * @return Set of roles assigned to the member, or null if the member is not part of this space.
346
     */
347
    public Set<SpaceMemberRole> getMemberRoles(IRI userId) {
348
        ensureInitialized();
×
349
        return data.users.get(userId);
×
350
    }
351

352
    /**
353
     * Check if a user is a member of this space.
354
     *
355
     * @param userId The IRI of the user to check.
356
     * @return true if the user is a member, false otherwise.
357
     */
358
    public boolean isMember(IRI userId) {
359
        ensureInitialized();
×
360
        return data.users.containsKey(userId);
×
361
    }
362

363
    public boolean isAdminPubkey(String pubkey) {
364
        ensureInitialized();
×
365
        return data.adminPubkeyMap.containsKey(pubkey);
×
366
    }
367

368
    /**
369
     * Get the list of pinned resources in this space.
370
     *
371
     * @return List of pinned resources.
372
     */
373
    public Set<Serializable> getPinnedResources() {
374
        ensureInitialized();
×
375
        return data.pinnedResources;
×
376
    }
377

378
    /**
379
     * Get the set of tags used for grouping pinned resources.
380
     *
381
     * @return Set of tags.
382
     */
383
    public Set<String> getPinGroupTags() {
384
        ensureInitialized();
×
385
        return data.pinGroupTags;
×
386
    }
387

388
    /**
389
     * Get a map of pinned resources grouped by their tags.
390
     *
391
     * @return Map where keys are tags and values are lists of pinned resources (Templates or GrlcQueries).
392
     */
393
    public Map<String, Set<Serializable>> getPinnedResourceMap() {
394
        ensureInitialized();
×
395
        return data.pinnedResourceMap;
×
396
    }
397

398
    /**
399
     * Returns the view displays and their associated nanopub IDs.
400
     *
401
     * @return Map of views to nanopub IDs
402
     */
403
    public List<ViewDisplay> getViewDisplays() {
404
        return data.viewDisplays;
×
405
    }
406

407
    /**
408
     * Get the default provenance IRI for this space.
409
     *
410
     * @return The default provenance IRI, or null if not set.
411
     */
412
    public IRI getDefaultProvenance() {
413
        return data.defaultProvenance;
×
414
    }
415

416
    /**
417
     * Get the roles defined in this space.
418
     *
419
     * @return List of roles.
420
     */
421
    public List<SpaceMemberRole> getRoles() {
422
        return data.roles;
×
423
    }
424

425
    /**
426
     * Get the super ID of the space.
427
     *
428
     * @return Always returns null. Use getIdSuperspace() instead.
429
     */
430
    public String getSuperId() {
431
        return null;
×
432
    }
433

434
    /**
435
     * Get the superspace ID.
436
     *
437
     * @return The superspace, or null if not applicable.
438
     */
439
    public Space getIdSuperspace() {
440
        if (!id.matches("https?://[^/]+/.*/[^/]*/?")) return null;
5!
441
        String superId = id.replaceFirst("(https?://[^/]+/.*)/[^/]*/?", "$1");
6✔
442
        if (spacesById.containsKey(superId)) {
4✔
443
            return spacesById.get(superId);
5✔
444
        }
445
        return null;
2✔
446
    }
447

448
    /**
449
     * Get superspaces of this space.
450
     *
451
     * @return List of superspaces.
452
     */
453
    public List<Space> getSuperspaces() {
454
        if (superspaceMap.containsKey(this)) {
×
455
            List<Space> superspaces = new ArrayList<>(superspaceMap.get(this));
×
456
            Collections.sort(superspaces, Ordering.usingToString());
×
457
            return superspaces;
×
458
        }
459
        return new ArrayList<>();
×
460
    }
461

462
    /**
463
     * Get subspaces of this space.
464
     *
465
     * @return List of subspaces.
466
     */
467
    public List<Space> getSubspaces() {
468
        if (subspaceMap.containsKey(this)) {
×
469
            List<Space> subspaces = new ArrayList<>(subspaceMap.get(this));
×
470
            Collections.sort(subspaces, Ordering.usingToString());
×
471
            return subspaces;
×
472
        }
473
        return new ArrayList<>();
×
474
    }
475

476
    /**
477
     * Get subspaces of a specific type.
478
     *
479
     * @param type The type of subspaces to retrieve.
480
     * @return List of subspaces of the specified type.
481
     */
482
    public List<Space> getSubspaces(String type) {
483
        List<Space> l = new ArrayList<>();
×
484
        for (Space s : getSubspaces()) {
×
485
            if (s.getType().equals(type)) l.add(s);
×
486
        }
×
487
        return l;
×
488
    }
489

490
    /**
491
     * Get alternative IDs for the space.
492
     *
493
     * @return List of alternative IDs.
494
     */
495
    public List<String> getAltIDs() {
496
        return data.altIds;
×
497
    }
498

499
    private synchronized void ensureInitialized() {
500
        Thread thread = triggerDataUpdate();
×
501
        if (!dataInitialized && thread != null) {
×
502
            try {
503
                thread.join();
×
504
            } catch (InterruptedException ex) {
×
505
                logger.error("failed to join thread", ex);
×
506
            }
×
507
        }
508
    }
×
509

510
    private synchronized Thread triggerDataUpdate() {
511
        if (dataNeedsUpdate) {
×
512
            Thread thread = new Thread(() -> {
×
513
                try {
514
                    SpaceData newData = new SpaceData();
×
515
                    setCoreData(newData);
×
516

517
                    newData.roles.add(SpaceMemberRole.ADMIN_ROLE);
×
518
                    newData.roleMap.put(SpaceMemberRole.HAS_ADMIN_PREDICATE, SpaceMemberRole.ADMIN_ROLE);
×
519

520
                    // TODO Improve this:
521
                    Multimap<String, String> spaceIds = ArrayListMultimap.create();
×
522
                    Multimap<String, String> resourceIds = ArrayListMultimap.create();
×
523
                    spaceIds.put("space", id);
×
524
                    resourceIds.put("resource", id);
×
525
                    for (String id : newData.altIds) {
×
526
                        spaceIds.put("space", id);
×
527
                        resourceIds.put("resource", id);
×
528
                    }
×
529

530
                    ApiResponse getAdminsResponse = QueryApiAccess.get(new QueryRef("get-admins", spaceIds));
×
531
                    boolean continueAddingAdmins = true;
×
532
                    while (continueAddingAdmins) {
×
533
                        continueAddingAdmins = false;
×
534
                        for (ApiResponseEntry r : getAdminsResponse.getData()) {
×
535
                            String pubkeyhash = r.get("pubkey");
×
536
                            if (newData.adminPubkeyMap.containsKey(pubkeyhash)) {
×
537
                                IRI adminId = Utils.vf.createIRI(r.get("admin"));
×
538
                                if (!newData.admins.contains(adminId)) {
×
539
                                    continueAddingAdmins = true;
×
540
                                    newData.addAdmin(adminId);
×
541
                                }
542
                            }
543
                        }
×
544
                    }
545
                    newData.admins.sort(User.getUserData().userComparator);
×
546

547
                    Multimap<String, String> getSpaceMemberParams = ArrayListMultimap.create(spaceIds);
×
548

549
                    for (ApiResponseEntry r : QueryApiAccess.get(new QueryRef("get-space-member-roles", spaceIds)).getData()) {
×
550
                        if (!newData.adminPubkeyMap.containsKey(r.get("pubkey"))) continue;
×
551
                        SpaceMemberRole role = new SpaceMemberRole(r);
×
552
                        newData.roles.add(role);
×
553

554
                        // TODO Handle cases of overlapping properties:
555
                        for (IRI p : role.getRegularProperties()) newData.roleMap.put(p, role);
×
556
                        for (IRI p : role.getInverseProperties()) newData.roleMap.put(p, role);
×
557

558
                        role.addRoleParams(getSpaceMemberParams);
×
559
                    }
×
560

561
                    for (ApiResponseEntry r : QueryApiAccess.get(new QueryRef("get-space-members", getSpaceMemberParams)).getData()) {
×
562
                        IRI memberId = Utils.vf.createIRI(r.get("member"));
×
563
                        SpaceMemberRole role = newData.roleMap.get(Utils.vf.createIRI(r.get("role")));
×
564
                        newData.users.computeIfAbsent(memberId, (k) -> new HashSet<>()).add(role);
×
565
                    }
×
566

567
                    for (ApiResponseEntry r : QueryApiAccess.get(new QueryRef("get-pinned-templates", spaceIds)).getData()) {
×
568
                        if (!newData.adminPubkeyMap.containsKey(r.get("pubkey"))) continue;
×
569
                        Template t = TemplateData.get().getTemplate(r.get("template"));
×
570
                        if (t == null) continue;
×
571
                        newData.pinnedResources.add(t);
×
572
                        String tag = r.get("tag");
×
573
                        if (tag != null && !tag.isEmpty()) {
×
574
                            newData.pinGroupTags.add(r.get("tag"));
×
575
                            newData.pinnedResourceMap.computeIfAbsent(tag, k -> new HashSet<>()).add(TemplateData.get().getTemplate(r.get("template")));
×
576
                        }
577
                    }
×
578
                    for (ApiResponseEntry r : QueryApiAccess.get(new QueryRef("get-pinned-queries", spaceIds)).getData()) {
×
579
                        if (!newData.adminPubkeyMap.containsKey(r.get("pubkey"))) continue;
×
580
                        GrlcQuery query = GrlcQuery.get(r.get("query"));
×
581
                        if (query == null) continue;
×
582
                        newData.pinnedResources.add(query);
×
583
                        String tag = r.get("tag");
×
584
                        if (tag != null && !tag.isEmpty()) {
×
585
                            newData.pinGroupTags.add(r.get("tag"));
×
586
                            newData.pinnedResourceMap.computeIfAbsent(tag, k -> new HashSet<>()).add(query);
×
587
                        }
588
                    }
×
589
                    for (ApiResponseEntry r : QueryApiAccess.get(new QueryRef("get-view-displays", resourceIds)).getData()) {
×
590
                        if (!newData.adminPubkeyMap.containsKey(r.get("pubkey"))) continue;
×
591
                        try {
592
                            ViewDisplay vd = new ViewDisplay(r);
×
593
                            newData.viewDisplays.add(vd);
×
594
                        } catch (IllegalArgumentException ex) {
×
595
                            logger.error("Couldn't generate view display object", ex);
×
596
                        }
×
597
                    }
×
598
                    data = newData;
×
599
                    dataInitialized = true;
×
600
                } catch (Exception ex) {
×
601
                    logger.error("Error while trying to update space data: {}", ex);
×
602
                }
×
603
            });
×
604
            thread.start();
×
605
            dataNeedsUpdate = false;
×
606
            return thread;
×
607
        }
608
        return null;
×
609
    }
610

611
    private void setCoreData(SpaceData data) {
612
        for (Statement st : rootNanopub.getAssertion()) {
12✔
613
            if (st.getSubject().stringValue().equals(getId())) {
7!
614
                if (st.getPredicate().equals(OWL.SAMEAS) && st.getObject() instanceof IRI objIri) {
14!
615
                    data.altIds.add(objIri.stringValue());
7✔
616
                } else if (st.getPredicate().equals(DCTERMS.DESCRIPTION)) {
5✔
617
                    data.description = st.getObject().stringValue();
6✔
618
                } else if (st.getPredicate().stringValue().equals("http://schema.org/startDate")) {
6✔
619
                    try {
620
                        data.startDate = DatatypeConverter.parseDateTime(st.getObject().stringValue());
6✔
621
                    } catch (IllegalArgumentException ex) {
×
622
                        logger.error("Failed to parse date {}", st.getObject().stringValue());
×
623
                    }
1✔
624
                } else if (st.getPredicate().stringValue().equals("http://schema.org/endDate")) {
6✔
625
                    try {
626
                        data.endDate = DatatypeConverter.parseDateTime(st.getObject().stringValue());
6✔
627
                    } catch (IllegalArgumentException ex) {
×
628
                        logger.error("Failed to parse date {}", st.getObject().stringValue());
×
629
                    }
1✔
630
                } else if (st.getPredicate().equals(HAS_ADMIN) && st.getObject() instanceof IRI obj) {
14!
631
                    data.addAdmin(obj);
4✔
632
                } else if (st.getPredicate().equals(HAS_PINNED_TEMPLATE) && st.getObject() instanceof IRI obj) {
5!
633
                    data.pinnedResources.add(TemplateData.get().getTemplate(obj.stringValue()));
×
634
                } else if (st.getPredicate().equals(HAS_PINNED_QUERY) && st.getObject() instanceof IRI obj) {
5!
635
                    data.pinnedResources.add(GrlcQuery.get(obj.stringValue()));
×
636
                } else if (st.getPredicate().equals(NTEMPLATE.HAS_DEFAULT_PROVENANCE) && st.getObject() instanceof IRI obj) {
5!
637
                    data.defaultProvenance = obj;
1✔
638
                }
639
            } else if (st.getPredicate().equals(NTEMPLATE.HAS_TAG) && st.getObject() instanceof Literal l) {
×
640
                data.pinGroupTags.add(l.stringValue());
×
641
                Set<Serializable> list = data.pinnedResourceMap.get(l.stringValue());
×
642
                if (list == null) {
×
643
                    list = new HashSet<>();
×
644
                    data.pinnedResourceMap.put(l.stringValue(), list);
×
645
                }
646
                list.add(TemplateData.get().getTemplate(st.getSubject().stringValue()));
×
647
            }
648
        }
1✔
649
    }
1✔
650

651
    @Override
652
    public String toString() {
653
        return id;
×
654
    }
655

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