@Test void allowsForUndefinedRelationship() { assertEquals(RelationshipType.of("wibble", "thing"), RelationshipType.of("wibble", "thing")); }
public static RelationshipType of(String id, String label) { switch (id) { case "is_a": return IS_A; case "http: case "part of": case "part_of": return PART_OF; case "subPropertyOf": return SUBPROPERTY_OF; case "http: case "has modifier": return HAS_MODIFIER; default: return cache.computeIfAbsent(id, key -> new RelationshipType(id, label)); } }
RelationshipType { public static RelationshipType of(String id, String label) { switch (id) { case "is_a": return IS_A; case "http: case "part of": case "part_of": return PART_OF; case "subPropertyOf": return SUBPROPERTY_OF; case "http: case "has modifier": return HAS_MODIFIER; default: return cache.computeIfAbsent(id, key -> new RelationshipType(id, label)); } } }
RelationshipType { public static RelationshipType of(String id, String label) { switch (id) { case "is_a": return IS_A; case "http: case "part of": case "part_of": return PART_OF; case "subPropertyOf": return SUBPROPERTY_OF; case "http: case "has modifier": return HAS_MODIFIER; default: return cache.computeIfAbsent(id, key -> new RelationshipType(id, label)); } } private  RelationshipType(String id, String name); }
RelationshipType { public static RelationshipType of(String id, String label) { switch (id) { case "is_a": return IS_A; case "http: case "part of": case "part_of": return PART_OF; case "subPropertyOf": return SUBPROPERTY_OF; case "http: case "has modifier": return HAS_MODIFIER; default: return cache.computeIfAbsent(id, key -> new RelationshipType(id, label)); } } private  RelationshipType(String id, String name); String getId(); String getLabel(); static RelationshipType of(String id, String label); boolean propagates(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
RelationshipType { public static RelationshipType of(String id, String label) { switch (id) { case "is_a": return IS_A; case "http: case "part of": case "part_of": return PART_OF; case "subPropertyOf": return SUBPROPERTY_OF; case "http: case "has modifier": return HAS_MODIFIER; default: return cache.computeIfAbsent(id, key -> new RelationshipType(id, label)); } } private  RelationshipType(String id, String name); String getId(); String getLabel(); static RelationshipType of(String id, String label); boolean propagates(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final RelationshipType IS_A; static final RelationshipType PART_OF; static final RelationshipType SUBPROPERTY_OF; static final RelationshipType HAS_MODIFIER; }