Adding types with interfaces using RDF triples in DQL

Update your schema to the following. It is not Schema compliant with GraphQL, but it is schema compliant with DGraph GraphQL schema input

type User  {
  username: String! @id @search(by: [hash])
  items: [Item] @hasInverse(field: createdby)
}

interface Item {
  id: ID!
  title: String! @search(by: [exact])
  createdby: User!
}
    
type Folder implements Item {
  featured_image: String
}

Then use:

<0x275f> <User.items> _:f1 .
 _:f1 <dgraph.type> "Folder" .
_:f1 <Item.title> "test" .
_:f1 <Item.createdby> <0x275f> .
_:f1 <Folder.featured_image> "test" .

And I believe that the dgraph.type should even have both "Folder" and "Item" in it. I am not sure that exact syntax though, either:

 _:f1 <dgraph.type> "Folder" "Item" .

or

 _:f1 <dgraph.type> "Folder" .
 _:f1 <dgraph.type> "Item" .

1 Like