-
Notifications
You must be signed in to change notification settings - Fork 162
mangled name already exists error when no context is passed #387
Copy link
Copy link
Closed
Labels
bugSomething that should work but isn't, with an example and a test case.Something that should work but isn't, with an example and a test case.
Description
given a schema:
id: https://w3id.org/linkml/examples/personinfo
prefixes:
linkml: https://w3id.org/linkml/
default_range: my_str
types:
my_str:
base: str
uri: xsd:string
classes:
C1:
attributes:
a:
C2:
attributes:
a:the following code:
RDFGenerator(env.input_path('linkml_issue_385.yaml')).serialize()yields:
ValueError: Class: "C1" attribute "a" - mangled name: c1__a already exists
This is fair enough, name clashes in attributes perhaps should be avoided (but this needs better defined)
However, if I pass in METAMODEL_CONTEXT_URI (which is what the CLI does by default)
RDFGenerator(env.input_path('linkml_issue_385.yaml')).serialize(context=[METAMODEL_CONTEXT_URI])This succeeds:
@prefix : <https://w3id.org/linkml/> .
@prefix linkml: <https://w3id.org/linkml/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/linkml/examples/personinfo/personinfo> a linkml:SchemaDefinition ;
linkml:classes <https://w3id.org/linkml/examples/personinfo/C1>,
<https://w3id.org/linkml/examples/personinfo/C2> ;
linkml:default_prefix "https://w3id.org/linkml/examples/personinfo/" ;
linkml:default_range <https://w3id.org/linkml/examples/personinfo/my_str> ;
linkml:generation_date "2021-09-30 14:21"^^xsd:dateTime ;
linkml:id <https://w3id.org/linkml/examples/personinfo> ;
linkml:metamodel_version "1.7.0" ;
linkml:prefixes [ linkml:prefix_prefix "linkml" ;
linkml:prefix_reference linkml: ] ;
linkml:slots <https://w3id.org/linkml/examples/personinfo/c1__a>,
<https://w3id.org/linkml/examples/personinfo/c2__a> ;
linkml:source_file "linkml_issue_385.yaml" ;
linkml:source_file_date "Thu Sep 30 14:21:01 2021"^^xsd:dateTime ;
linkml:source_file_size 240 ;
linkml:types <https://w3id.org/linkml/examples/personinfo/my_str> .
<https://w3id.org/linkml/examples/personinfo/c1__a> a linkml:SlotDefinition ;
skos:inScheme <https://w3id.org/linkml/examples/personinfo> ;
linkml:alias "a" ;
linkml:domain_of <https://w3id.org/linkml/examples/personinfo/C1> ;
linkml:owner <https://w3id.org/linkml/examples/personinfo/C1> ;
linkml:range <https://w3id.org/linkml/examples/personinfo/my_str> ;
linkml:slot_uri <https://w3id.org/linkml/examples/personinfo/a> .
<https://w3id.org/linkml/examples/personinfo/c2__a> a linkml:SlotDefinition ;
skos:inScheme <https://w3id.org/linkml/examples/personinfo> ;
linkml:alias "a" ;
linkml:domain_of <https://w3id.org/linkml/examples/personinfo/C2> ;
linkml:owner <https://w3id.org/linkml/examples/personinfo/C2> ;
linkml:range <https://w3id.org/linkml/examples/personinfo/my_str> ;
linkml:slot_uri <https://w3id.org/linkml/examples/personinfo/a> .
<https://w3id.org/linkml/examples/personinfo/a> a linkml:SlotDefinition .
<https://w3id.org/linkml/examples/personinfo/my_str> a linkml:TypeDefinition ;
skos:inScheme <https://w3id.org/linkml/examples/personinfo> ;
linkml:base "str" ;
linkml:definition_uri <https://w3id.org/linkml/examples/personinfo/MyStr> ;
linkml:uri <http://example.org/UNKNOWN/xsd/string> .
<https://w3id.org/linkml/examples/personinfo/C1> a linkml:ClassDefinition ;
skos:inScheme <https://w3id.org/linkml/examples/personinfo> ;
linkml:attributes <https://w3id.org/linkml/examples/personinfo/a> ;
linkml:class_uri <https://w3id.org/linkml/examples/personinfo/C1> ;
linkml:definition_uri <https://w3id.org/linkml/examples/personinfo/C1> ;
linkml:slot_usage [ ] ;
linkml:slots <https://w3id.org/linkml/examples/personinfo/c1__a> .
<https://w3id.org/linkml/examples/personinfo/C2> a linkml:ClassDefinition ;
skos:inScheme <https://w3id.org/linkml/examples/personinfo> ;
linkml:attributes <https://w3id.org/linkml/examples/personinfo/a> ;
linkml:class_uri <https://w3id.org/linkml/examples/personinfo/C2> ;
linkml:definition_uri <https://w3id.org/linkml/examples/personinfo/C2> ;
linkml:slot_usage [ ] ;
linkml:slots <https://w3id.org/linkml/examples/personinfo/c2__a> .Here the two attributes with alias "a" are protected, with different URIs (c1__a and c2__a)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething that should work but isn't, with an example and a test case.Something that should work but isn't, with an example and a test case.