Skip to content

Commit

Permalink
Fix incorrect IRI for linkml:Uriorcurie.
Browse files Browse the repository at this point in the history
The IRI of the LinkML type "uriorcurie" is not

  https://w3id.org/linkml/uriOrCurie

but

  https://w3id.org/linkml/Uriorcurie

We fix the code that deals with extension definitions to expect the
correct IRI, while still accepting the incorrect one for backwards
compatibility.
  • Loading branch information
gouttegd committed Jul 23, 2024
1 parent 65f9f15 commit 2bedd9f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public enum ValueType {
BOOLEAN("http://www.w3.org/2001/XMLSchema#boolean"),
DATE("http://www.w3.org/2001/XMLSchema#date"),
DATETIME("http://www.w3.org/2001/XMLSchema#datetime"),
IDENTIFIER("https://w3id.org/linkml/uriOrCurie"),
IDENTIFIER("https://w3id.org/linkml/Uriorcurie", "https://w3id.org/linkml/uriOrCurie"),
OTHER(null);

private final static Map<String, ValueType> MAP;
Expand All @@ -42,16 +42,26 @@ public enum ValueType {
for ( ValueType vt : ValueType.values() ) {
if ( vt != ValueType.OTHER ) {
map.put(vt.iri, vt);
if ( vt.alias != null ) {
map.put(vt.alias, vt);
}
}
}

MAP = Collections.unmodifiableMap(map);
}

private final String iri;
private final String alias;

ValueType(String iri) {
this.iri = iri;
this.alias = null;
}

ValueType(String iri, String alias) {
this.iri = iri;
this.alias = alias;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ void testAcceptDefinedExtensions() throws IOException, SSSOMFormatException {
compare(new ExtensionDefinition("ext_bar", "https://example.org/properties/barProperty",
"http://www.w3.org/2001/XMLSchema#integer"), definitions.get("ext_bar"));
compare(new ExtensionDefinition("ext_baz", "https://example.org/properties/bazProperty",
"https://w3id.org/linkml/uriOrCurie"), definitions.get("ext_baz"));
"https://w3id.org/linkml/Uriorcurie"), definitions.get("ext_baz"));
compare(new ExtensionDefinition("ext_foo", "https://example.org/properties/fooProperty"),
definitions.get("ext_foo"));

Expand Down Expand Up @@ -389,7 +389,7 @@ void testAcceptAllExtensions() throws IOException, SSSOMFormatException {
compare(new ExtensionDefinition("ext_bar", "https://example.org/properties/barProperty",
"http://www.w3.org/2001/XMLSchema#integer"), definitions.get("ext_bar"));
compare(new ExtensionDefinition("ext_baz", "https://example.org/properties/bazProperty",
"https://w3id.org/linkml/uriOrCurie"), definitions.get("ext_baz"));
"https://w3id.org/linkml/Uriorcurie"), definitions.get("ext_baz"));
compare(new ExtensionDefinition("ext_foo", "https://example.org/properties/fooProperty"),
definitions.get("ext_foo"));
compare(new ExtensionDefinition("ext_undeclared_baz", "http://sssom.invalid/ext_undeclared_baz"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# type_hint: xsd:integer
# - slot_name: ext_baz
# property: EXPROP:bazProperty
# type_hint: linkml:uriOrCurie
# type_hint: linkml:Uriorcurie
# - slot_name: ext_foo
# property: EXPROP:fooProperty
#ext_undeclared_foo: Foo B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# type_hint: xsd:integer
# - slot_name: ext_baz
# property: EXPROP:bazProperty
# type_hint: linkml:uriOrCurie
# type_hint: linkml:Uriorcurie
# - slot_name: ext_foo
# property: EXPROP:fooProperty
#ext_foo: Foo A
Expand Down

0 comments on commit 2bedd9f

Please sign in to comment.