Ability to limit the scope of a relation

Is your feature request related to a problem? Please describe.

The add relation pop-up in the create type view lists all the relations across all object types, even the ones such as the camera, camera aperture, camera exposure & rotten tomato scores, etc.

These relations are tightly coupled to an objects type. A rotten tomato score is not applicable to any type except a media or a web series. Same goes for the camera exposure relations which is only applicable for the image type. Since the Object, Types and relations closely resemble the real world usage, it would be better to provide an option to restrict the scope of the relation to be only applicable for a specific object type.

Describe the solution you’d like

Currently, each relation type object seems to be having the following relations:

It would be great to add one more relation to the relation type object named Belongs to which takes a list of ā€œtypeā€ types for which the relation is applicable. So for the camera relation, the belongs to relation consists of the value ā€œImageā€ meaning that the relation is only applicable to the image type. If a user wants the relation to his type as well, he can add his type to the belongs to field of the camera relation which enables him to add the relation to his type as well. A special value ā€œ*ā€ or similar can be used to denote that the relation is applicable for any user created types

Edit 1: There’s a similar request for Relation Scope where an object relation should only display suitable types. I guess people upvoting this would also love that request:

https://community.anytype.io/d/741-specify-type-of-relation

72 Likes

I’ve been struggling with this too, thanks for the proposal!

3 Likes

That’s a great proposal! Without something like this the amount of mostly irrelevant relations will become extremely big over time I’m afraid.

1 Like

I figured leaving this list empty can just as well mean the relation is applicable to any type of object.

2 Likes

Currently, an Object relation can hold references to objects of any type. The Author relation on a Book can reference other Books, or Movies, or Daily Plans.

I’d like to be able to define Author as a specifically Human relation. Only Humans would be suggested when selecting that relation and searching for objects to include.

ā€œJust don’t put non-Human objects in thereā€ is the obvious response, but I’ve already run into a few situations where this feature would be handy. For example: creating an Event and filling its Invitees relation, you might not already have a guest list in mind, so you’d want to see the list of Humans (or Humans tagged ā€˜people I know’, because Katherine Hepburn is a Human but probably won’t respond) and select from it. Even if you do have guests in mind, tapping them all from a list of 60 suggestions is a lot nicer than typing a search for each one.

It could also help with making search results more relevant, and possibly even make certain kinds of searches possible that currently aren’t. If a relation is limited to Humans, and you search ā€œwriterā€ in the suggestion list, it could limit the results to humans tagged as writers, when searching all objects it would also show every Book, Movie, and Article object because they mention writers.

5 Likes

This has been raised already over [here](Ability to limit the scope of a relation). We could merge this into the exisiting one

1 Like

This settings could also be tied to the type, not only to the relation itself. For example, when editing a type, I would edit the relations belonging to that type and, for relations of the kind Object, I would be able to configure the Object types this relation is allowed to link to.

And if there could be a setting to limit to a unique type of object, it would even be possible to implement calculations based on this objects relations, e. g. a string concatenation of two of it’s relations (not only the title).

1 Like

In some cases I might want a Relation to only accept a limited set of values.

For example, my ā€œContinentsā€ Relation will only have a limited set of allowed values (Africa, South America etc.).

Ideally I’d like to set those as I create the Relation.

Of course, I’d also like to be able to edit/add allowed values later if needed (though priority in the UI should be in suggesting the allowed values).

5 Likes

Seems to be related to this request:

[Ability to limit the scope of a relation](Ability to limit the scope of a relation)

1 Like

@thiago_nascimentodf Indeed! I searched but somehow didn’t find that one.

Can I merge or does an admin need to do it?

I don’t know. Maybe only admins can merge.

1 Like

There is an earlier request from @laurara that seems to deal with exactly that same issue, though related only to tag/status relation in templates.

[Select preferred options for status/tag relation within templates](Select preferred options for status/tag relation within templates)

Maybe they could be merged.

I was testing Anytype thoughtfully (basically implementing PPV) and this was a big sticking point for me as well!

Would be really confusing for a new user too (who is used to Notion or any other app).

@triangles

The usecase provided by triangles is on point! :smiley:

2 Likes

We have this feature in Desktop in the latest release and it’s comming to mobile devices soon!

[UPD] not this one, that one: Specify which objects to display and make selectable for a given relation

Correct me if I am wrong but this request is to limit the relations displayed in the add relation popup whereas the one added in the release is this one?
https://community.anytype.io/d/741-specify-type-of-relation


Edit: The above linked request limits the object displayed in the relation popup for adding new objects. This request enables one to prevent one from adding a relation to other types. So if this gets implemented, I can have a relation named ā€œContainsā€ for a Type say A, and also can have a different relation with the same name ā€œContainsā€ for Type B. However, since the relations are constrained to types A and B respectively, this relation cannot be added to any other Type thereby reducing the noise in the add relation popup and encourages users to create more type specific relations with confidence

2 Likes

Correct me if I am wrong but this request is to limit the relations displayed in the add relation popup whereas the one added in the release is this one?

You right, i’ve marked the wrong one!

Edit: The above linked request limits the object displayed in the relation popup for adding new objects.

I get your point. We will extend relation list result with more meta-data, like Type for sure!

2 Likes

Agreeing this feature would be helpful.

Additionally: When viewing the relations library, it would be very helpful to see the relations grouped in some way. Either by their scope limit (if this feature is implemented) OR even being able to manually group them.

Right now, the relations library gets unwieldy very quickly as I add specific relations for specific object types and then they seem to appear in the library in random order!

Is this already possible with the ā€œstatusā€ relation type? It works the same way as Notion’s multi-select property. Just create a new relation using the status type, then add your options and that will get you what you are describing here.

This workaround would not work if you wanted to limit the Relation options to a specific subset of Objects.

Right now a ā€œstatusā€ relation type only accepts Text as the Relation option. So in the example of the ā€œContinentsā€ Relation, ā€œAfricaā€ and ā€œSouth Americaā€ would be text.

This could be remedied if a Status relation could accept Objects as their Relation option, instead of just text. But this would also be solved if you could limit the scope of a Relation to one or more Types.