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

knowledgepixels / nanodash / 17911650819

22 Sep 2025 09:58AM UTC coverage: 13.581% (-0.03%) from 13.608%
17911650819

push

github

tkuhn
feat: Inverse and equivalent properties for Space member roles

435 of 4040 branches covered (10.77%)

Branch coverage included in aggregate %.

1115 of 7373 relevant lines covered (15.12%)

0.67 hits per line

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

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

3
import java.io.Serializable;
4
import java.util.stream.Stream;
5

6
import org.eclipse.rdf4j.model.IRI;
7
import org.nanopub.extra.services.ApiResponseEntry;
8

9
import com.google.common.collect.Multimap;
10

11
public class SpaceMemberRole implements Serializable {
12

13
    private IRI mainProperty;
14
    private String name;
15
    private boolean isInverse;
16
    private IRI[] equivalentProperties, inverseProperties;
17

18
    public SpaceMemberRole(ApiResponseEntry e) {
×
19
        this.mainProperty = Utils.vf.createIRI(e.get("role"));
×
20
        this.name = e.get("roleName");
×
21
        this.isInverse = "true".equals(e.get("isInverse"));
×
22
        equivalentProperties = stringToIriArray(e.get("equivalent"));
×
23
        inverseProperties = stringToIriArray(e.get("inverse"));
×
24
    }
×
25

26
    public SpaceMemberRole(IRI mainProperty, String name, boolean isInverse, IRI[] equivalentProperties, IRI[] inverseProperties) {
×
27
        this.mainProperty = mainProperty;
×
28
        this.name = name;
×
29
        this.isInverse = isInverse;
×
30
        this.equivalentProperties = equivalentProperties;
×
31
        this.inverseProperties = inverseProperties;
×
32
    }
×
33

34
    public IRI getMainProperty() {
35
        return mainProperty;
×
36
    }
37

38
    public String getName() {
39
        return name;
×
40
    }
41

42
    public boolean isInverse() {
43
        return isInverse;
×
44
    }
45

46
    public IRI[] getEquivalentProperties() {
47
        return equivalentProperties;
×
48
    }
49

50
    public IRI[] getInverseProperties() {
51
        return inverseProperties;
×
52
    }
53

54
    public void addRoleParams(Multimap<String, String> params) {
55
        if (isInverse) {
×
56
            params.put("invrole", mainProperty.stringValue());
×
57
            for (IRI p : equivalentProperties) params.put("invrole", p.stringValue());
×
58
            for (IRI p : inverseProperties) params.put("role", p.stringValue());
×
59
        } else {
60
            params.put("role", mainProperty.stringValue());
×
61
            for (IRI p : equivalentProperties) params.put("role", p.stringValue());
×
62
            for (IRI p : inverseProperties) params.put("invrole", p.stringValue());
×
63
        }
64
    }
×
65

66
    public static final IRI ADMIN_ROLE_IRI = Utils.vf.createIRI("https://w3id.org/kpxl/gen/terms/hasAdmin");
×
67
    public static final SpaceMemberRole ADMIN_ROLE = new SpaceMemberRole(ADMIN_ROLE_IRI, "admin", true, new IRI[] {}, new IRI[] {});
×
68

69
    private static IRI[] stringToIriArray(String string) {
70
        if (string == null || string.isBlank()) return new IRI[] {};
×
71
        return Stream.of(string.split(" ")).map(s -> Utils.vf.createIRI(s)).toArray(IRI[]::new);
×
72
    }
73

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