Jack Cheng
Jack Cheng

Reputation: 409

Freebase: constrain property to be empty

Is there a way to constrain a property to be empty in a Freebase query? In particular, I want to find all the properties that have unique=null and /freebase/type_hints/mediator=null. So something like this:

[{
  type: "/type/property",
  unique: null,
  "expected_type" : {
    "/freebase/type_hints/mediator" : null
  }
}]​

except I want the null to actually mean a null value for those properties. Is this possible?

Upvotes: 1

Views: 146

Answers (1)

Philip Kendall
Philip Kendall

Reputation: 4314

Use "optional": "forbidden".

[{
  "id":     null,
  "name":   null,
  "type":   "/type/property",
  "unique": {
    "value":    null,
    "optional": "forbidden"
  },
  "expected_type": {
    "/freebase/type_hints/mediator": {
      "value":    null,
      "optional": "forbidden"
    }
  }
}]​

In general, you don't need anything other than the "optional": "forbidden" in the clause, but MQL doesn't let you have a clause containing only directives and no actual properties so the "value": null is just there to keep it happy.

Upvotes: 2

Related Questions