[Developers] query to determine if a property has at least one link

Jack Alves jack at metaweb.com
Wed May 2 02:01:24 UTC 2007


I wrote a mjt script that queries topics of a specified type and counts the
number of properties that have at least one link (value or instance). 
http://taco/~jack/mjt/TypeCoverage.html?domain=aviation&type=aircraft_model&
prop_key=manufacturer

Can you recommend a low cost query for this script? The following works but
returns too much data,

[{
  "id":null,
  "maiden_flight":[{}],
  "type":"/aviation/aircraft_model"
}]


The following seems to works for properties that expect value types or
instances with a single type,

[{
  "id":null,
  "maiden_flight":[{
    "limit":1,
    "type":null
  }],
  "name":null,
  "type":"/aviation/aircraft_model"
}]

The query fails if the property instance has multiple types,

[{
  "id":null,
  "manufacturer":[{
    "limit":1,
    "type":null
  }],
  "name":null,
  "type":"/aviation/aircraft_model"
}]


I can fix the query to work for property instances that have multiple types,

[{
  "id":null,
  "manufacturer":[{
    "limit":1,
    "type":[]
  }],
  "name":null,
  "type":"/aviation/aircraft_model"
}]

but then the query fails for value types with, "message": "value field
'type' must be null or a value",

[{
  "id":null,
  "maiden_flight":[{
    "limit":1,
    "type":[]
  }],
  "name":null,
  "type":"/aviation/aircraft_model"
}]



Another option I thought of is to query for the expected type of the
property then generate the compatible query.







More information about the Developers mailing list