Querying reverse edges whose names contain colons


(Pierluigi M) #1

I created several edges whose names contain a ‘:’ (they are derived from RDF data). Here is one example from the schema

<epi:parent_doc>  uid @reverse .

There is no problem using <epi:parent_doc>, but the reverse syntax does not seem to work. ~<epi:parent_doc> causes this error: “: Tablet isn’t being served by this instance.”
Querying ~epi:parent_doc does not cause complaints, but there are no results returned (there definitely are triples with this edge). Is it possible to reverse an edge whose name includes a colon (or some other “nonstandard” character)?


(Michel Conrado) #2

You need to use Angle brackets around the predicate
e.g:

{
  q(func: uid(0x9c41)){
    uid
    <epi:parent_doc> {
      uid
      parent_doc
    }
  }
}

Result

{
  "data": {
    "q": [
      {
        "uid": "0x9c41",
        "epi:parent_doc": [
          {
            "uid": "0x9c42",
            "parent_doc": "true"
          }
        ]
      }
    ]
  }
}

Reverse

{
  q(func: has(parent_doc)){
    uid
    parent_doc
    <~epi:parent_doc> {
      uid
    }
  }
}

Result

{
  "data": {
    "q": [
      {
        "uid": "0x9c42",
        "parent_doc": "true",
        "~epi:parent_doc": [
          {
            "uid": "0x9c41"
          }
        ]
      }
    ]
  }
}