speced / respec

A tool for creating technical documents and web standards
https://respec.org/
Other
724 stars 389 forks source link

Almost identical concepts (lowercase and uppercase) #4821

Open floresbakker opened 1 month ago

floresbakker commented 1 month ago

Discussed in https://github.com/speced/respec/discussions/4818

Originally posted by **floresbakker** October 19, 2024 Hi there ReSpec community! I am trying to create a specification document that identifies two concepts that have almost identical names. One is for a OWL class called ex:Example and one is for an OWL object property called ex:example. In the RDF/OWL world, it is custom to write classes with a name starting with a upper case letter, while properties are written with a name starting with a lower case letter. The two concepts are semantically different from eachother, hence I want to show this in the ReSpec document. However, the ReSpec validation shows that the two concepts are seen as one, and it warns me that there is a duplicate definition of ex:example.

Start your spec!

[=ex:Example=] This is a class. [=ex:example=] This is a property.
I tried using scoped concepts as described in https://respec.org/docs/#scoped-concepts:

Start your spec!

[=class/ex:Example=] This is a class. [=property/ex:example=] This is a property.
Still I get a duplicate definition warning. Even an example that I took from https://respec.org/docs/#scoped-concepts results in a warning:

Start your spec!

[=list/for each=] This is a function for lists. [=map/for each=] This is a function for maps.
What am I doing wrong here?
marcoscaceres commented 3 weeks ago

How we handle this in WebIDL is through a special syntax, like {{Example/example}}, which treats things as case insensitive.

For RDF/OWL, you would need a special syntax to represent and link to RDF/OWL classes and properties.

This is doable though, if you treat owl as XML. If you want treat it as N3 or whatever notation (I don't know RDF), you would need a specialized parser and to define particular definitions types.

floresbakker commented 6 days ago

How we handle this in WebIDL is through a special syntax, like {{Example/example}}, which treats things as case insensitive.

For RDF/OWL, you would need a special syntax to represent and link to RDF/OWL classes and properties.

This is doable though, if you treat owl as XML. If you want treat it as N3 or whatever notation (I don't know RDF), you would need a specialized parser and to define particular definitions types.

Hi Marco, thank you for replying. However, I don't think I should need a special syntax or parser to represent RDF/OWL classes and properties. In the end, I can treat it as ordinary ReSpec concepts and then using the scoped concepts approach that ReSpec already supports. The issue is that the standard ReSpec scoped concepts functionality has faulty behavior, not related to the RDF/OWL domain.

Look at the example that ReSpec itself gives:

"For example, the definition of a forEach() method for a list behaves differently from the definition of forEach() method for a map: the former operates on a single item, while the letter operates on a key/value pair. To make the relationship clear, we would write [=map/for each=], which is different to, say, [=list/for each=]."

I translate this to the following HTML to test this example:

<!DOCTYPE html>
  <html lang="en">
    <head>
       <meta charset="utf-8">
         <title>Scoped Concepts bug</title>
         <script class="remove" defer="" src="https://www.w3.org/Tools/respec/respec-w3c"></script>
         <script class="remove">   
          var respecConfig = {
          };
          // All config options at https://respec.org/docs/ 
         </script>
     </head>
     <body>
       <section>
          <h2>Here should be two distinguished concepts</h2>
          <dfn>[=list/for each=]</dfn>
           This is a function for lists.      
          <dfn>[=map/for each=]</dfn>
           This is a function for maps.
       </section>
</body>
</head>
</html>

This leads to an incorrect and unwanted "Duplicate definition(s) of 'for each'" in the ReSpec validation, whereas the ReSpec documentation writes that this notation should be enough to distinguish two concepts from each other. If it is enough to distinguish two concepts from each other, why would I get a duplicate warning then?

I am planning to use the same trick to distinguish a class from a property, but the scoped concepts functionality of ReSpec should then really work instead of giving me a duplicate warning for their own example.

I hope I could make it a bit more clear now :)