Skip to content

Allow to set vocabulary when hydrating class and property#2429

Open
jimsafley wants to merge 2 commits intodevelopfrom
hydrate-vocab
Open

Allow to set vocabulary when hydrating class and property#2429
jimsafley wants to merge 2 commits intodevelopfrom
hydrate-vocab

Conversation

@jimsafley
Copy link
Member

See #2428

This change makes it possible to assign a vocabulary to a resource class or property via the API.

@jimsafley jimsafley requested a review from zerocrates January 30, 2026 15:58
@zerocrates
Copy link
Member

Hmm... enabling this would make it easy to, say, update a member by moving it from one vocab to another. I'm not sure whether we want to improve the api stuff for vocabs and members individually, or instead push the RDF importer via the API and have that be the intended entry point like it is for the UI.

I haven't looked closely at this in a while but if I remember correctly these will work through the API, just only if edited/created via their parent vocab.

@jimsafley
Copy link
Member Author

I haven't looked closely at this in a while but if I remember correctly these will work through the API, just only if edited/created via their parent vocab.

Running the following will delete all existing properties, replacing them with the "Foo" property.

PATCH /api/vocabularies/1

{
    "o:property": [
        {
            "o:local_name": "foo"
            "o:label": "Foo",
        }
    ]
}

For a PATCH that's not expected and certainly destructive. The only way to safely create a property via the vocabulary endpoint is to include ID'd references to all existing properties as well. Note that when GETing a vocabulary, the response does not include its members.

@zerocrates
Copy link
Member

zerocrates commented Jan 30, 2026

Well it's how patch works everywhere we have it. Patch an item with one file and you'll delete the others, etc. Though yes, that the output doesn't include these may make it a more likely mistake.

The design of what we have is based on the assumption that you'll create the vocab all at once with its members. In that case it's not really an issue, but editing/adding after the fact, it doesn't offer much for that.

If creation of new members is the main concern we could hydrate the vocab only on create, that's an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments