solid / type-indexes

About Type Indexes and how they can be used by Solid developers.
https://solid.github.io/type-indexes/
MIT License
7 stars 3 forks source link

How to add multiple instances of the same class to the type index #32

Open angelo-v opened 6 months ago

angelo-v commented 6 months ago

My understanding until today was, that there should only be one type registration per class, and I list all the instances under the solid:instance predicate, like this

<#id1711048996537> 
    solid:forClass <http://www.w3.org/2006/vcard/ns#AddressBook>;
    solid:instance ex:first-address-book, ex:second-address-book .

However I noticed, that the SolidOS contacts-pane creates a new type registration for each address book like this:

<#id1711048996537> solid:forClass <http://www.w3.org/2006/vcard/ns#AddressBook>;
        solid:instance ex:first-address-book .

<#id1711049030051> solid:forClass <http://www.w3.org/2006/vcard/ns#AddressBook>;
        solid:instance ex:second-address-book .

Which one is correct, or should either be allowed?

Also: Is it allowed to leave out the solid:TypeRegistration type as SolidOS does?

jeff-zucker commented 6 months ago

Unless there's something I'm missing, I would say that either a list of instances or separate registrations per instance are both acceptable.

: Is it allowed to leave out the solid:TypeRegistration type as SolidOS does?

I assume you mean omitting something like :X a solid:TypeRegistration;. Normally it is good practice to include types, but since TypeRegistrations are the only type expected in the index, I'm not sure it makes a practical difference.

This question is also related to #29 .

angelo-v commented 6 months ago

If all is allowed it adds more complexity to the clients reading from type index. It is much easier to just query for the one solid:TypeRegistration that matches the right forClass compared to having to consider multiple registrations.

Also I am not sure if it imposes security issues if anything that is not a TypeRegistrations makes statements about where to find things. But I guess this is not an issue as long as we only read from the trusted type index document