Any documentation on GraphQL RootRDFMutation ?

13 views
Skip to first unread message

elvin.d...@gmail.com

unread,
Jun 25, 2021, 6:41:23 AM6/25/21
to TopBraid Suite Users
Hi
I'm kind of stuck on implementing a mutation in graphql that modifies a property by adding multiple URIs for the same predicate.

For example I wanted to add multiple subjects (dct:subject) to a single resource, I would need a parameter $subjectURIs:[ID] and implement it into the query. I am using Apollo Graphql as a middleware solution, but whatever I try - I keep getting errors in my syntax.

Unfortunately I cannot find any documentation on how to use RootRDFMution with addValues for example. Is there any documentation or more examples?

All I have is this https://www.topquadrant.com/technology/graphql/graphql-mutations/ and the GraphQL API that comes with EDG.

Example:

export const UPDATE_ExampleResource = gql`
    mutation exampleResourceMutation ($uri:ID, $subjectUri:[ID]) {
      updateExampleResource ( input: {
        uri: $uri
        subject: {
          uri: $subjectUri
        }
      })
     
      report {
        addedCount
        deletedCount
      }
      commit (message: "added subjects")
    }
`;
I have also been looking at addValues but I am not sure how to implement this:

 addValues(
        resource: $uri,
        predicate: "subject",
        values:$subjectUri
      )


Many thanks

Irene Polikoff

unread,
Jun 25, 2021, 10:48:38 AM6/25/21
to topbrai...@googlegroups.com
Update mutation will replace any existing information about resource with the new information. Basically deleting all existing triple with the resource as the subject and then adding triples you provided.

If you want to add information to already existing resource without removing information that is already there, use addToResourceType where ResourceType = name of the class your resource belongs to. This blog has an example of using this mutation https://www.topquadrant.com/querying-topbraid-edg-with-graphql/.


When you use GraphiQL, in the documentation you will see addToX for each class in your graph:


We recommend to first try the mutation in GraphQL as it checks the syntax, gives you autocomplete, etc.


--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/c62a7b62-f78f-4763-9efb-722b78f55180n%40googlegroups.com.

Elvin Dechesne

unread,
Jun 25, 2021, 6:11:05 PM6/25/21
to topbrai...@googlegroups.com
Thanks for the advice, I will give it a try!
Cheers

You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/mms_HL8gEY8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/7DB14A6B-0423-4D8E-8E59-CB2F7A0D7FAA%40topquadrant.com.


--
Elvin Dechesne
Reply all
Reply to author
Forward
0 new messages