Using predicate as subject?

I would like to add more information (triples) about a predicate.

In RDF it would be acceptable to put the predicate (in this case swedishURL) in the subject position to add relevant metadata for it:

<swedishURL> <regexFormat> "my-regex"

It is often also relevant to put in the object position:

<formX> <contains> <swedishURL>

But it seems the predicates in Dgraph are not accessible via uid / part of the actual graph?

Am I mistaken or are there some workarounds to this?

Thanks!

Correct, the ‘predicate’ itself is only allowable in the predicate position of the RDF (SPO). The subject of a dgraph RDF can only be a uid (usually a hex encoded integer).

You very well could make a node that represents and contains metadata about a predicate and access it as such:

{q(func: eq(mypredicate,"swedishURL")){ regexFormat }}

with the understanding that mypredicate is used as a unique ID to identify nodes that contain metadata for your predicate (this is tracked completely separately to the lifecycle of the predicate as a storage medium)

updates can use that same id:

upsert{
  query{
    # get the uid of the mypredicate=="swedishURL" node, whatever it is.
    pid as var(func: eq(mypredicate,"swedishURL"))
  }
  mutation{
    set {
      # use that uid collected above as the subject
      uid(pid) <regexFormat> "my-regex" .
    }
  }
}

Thank you for confirming.

with the understanding that mypredicate is used as a unique ID to identify nodes that contain metadata for your predicate (this is tracked completely separately to the lifecycle of the predicate as a storage medium)

With that, it indeed seems reasonable to have a separate lifecycle; in a way a superset of metadata for the predicates used in DQL schema:

type Predicate { … } (or Property)