Below we provide a few example of useful and interesting queries that can be run against the astorbDB
API. The provided examples
will hopefully be good instruction and for writing custom queries. Again, the basic steps for using any GraphQL API are:
astorbDB
GraphQL API. This
page focuses on the first step, writing queries. We will present a "question", that can then be answered with the following
provided "query".
query ExampleQuery {
minorplanet(where: {ast_number: {_is_null: true}}, limit: 5, order_by: {h: asc_nulls_last}) {
h
designames {
str_designame
}
}
}
{
"data": {
"minorplanet": [
{
"h": 3.38,
"designames": [
{
"str_designame": "2014 UZ224"
}
]
},
{
"h": 3.52,
"designames": [
{
"str_designame": "2021 DR15"
}
]
},
{
"h": 3.66,
"designames": [
{
"str_designame": "2018 VG18"
}
]
},
{
"h": 3.99,
"designames": [
{
"str_designame": "2010 KZ39"
}
]
},
{
"h": 4,
"designames": [
{
"str_designame": "2021 LL37"
}
]
}
]
}
query ExampleQuery {
albedo(where: {surveydatum: {minorplanet: {designame: {str_designame: {_eq: "Ceres"}}}}}) {
albedo
diameter
eta
surveydatum {
citation {
citation_url
}
}
}
}
{
"data": {
"albedo": [
{
"albedo": 0.0936,
"diameter": 933,
"eta": null,
"surveydatum": {
"citation": {
"citation_url": "http://sbn.psi.edu/pds/asteroid/EAR_A_VARGBDET_5_OCCALB_V1_0.zip"
}
}
},
{
"albedo": 0.087,
"diameter": 973.89,
"eta": 0.82,
"surveydatum": {
"citation": {
"citation_url": "https://darts.isas.jaxa.jp/astro/akari/catalogue/AcuA.html"
}
}
},
{
"albedo": 0.1132,
"diameter": 848.4,
"eta": 0.756,
"surveydatum": {
"citation": {
"citation_url": "http://sbn.psi.edu/pds/asteroid/IRAS_A_FPA_3_RDR_IMPS_V6_0.zip"
}
}
}
]
}
}
Note that this query makes use of the ephemeris table. Querying against the ephemeris table can produce long running queries. Always specify a single date when querying against the ephemeirs table.
query ExampleQuery {
ephemeris(
where: {eph_date: {_eq: "2023-06-07"}, galactic_latitude: {_gte: "20"}, v_mag: {_lte: "18"}}
order_by: {total_error: desc_nulls_last}
) {
minorplanet {
h
ast_number
designameByIdDesignationPrimary {
str_designame
}
}
ra
dec
v_mag
galactic_latitude
total_error
}
}
{
"data": {
"ephemeris": [
{
"minorplanet": {
"h": 20.15,
"ast_number": null,
"designameByIdDesignationPrimary": {
"str_designame": "2001 LD"
}
},
"ra": 3.5609971538,
"dec": 0.90825472284,
"v_mag": 17.452524076,
"galactic_latitude": 63.713669605,
"total_error": 4.006143561783208
},
{
"minorplanet": {
"h": 19.25,
"ast_number": null,
"designameByIdDesignationPrimary": {
"str_designame": "2020 DB5"
}
},
"ra": 3.4629122596,
"dec": 0.22036013737,
"v_mag": 15.205345667,
"galactic_latitude": 74.59321687,
"total_error": 1.8570788122498227
},
{
"minorplanet": {
"h": 18.34,
"ast_number": 513125,
"designameByIdDesignationPrimary": {
"str_designame": "1997 GC32"
}
},
"ra": 3.2677353906,
"dec": 0.68083294578,
"v_mag": 17.308827123,
"galactic_latitude": 77.223547918,
"total_error": 0.5397684988207818
},
{
"minorplanet": {
"h": 15.82,
"ast_number": 333175,
"designameByIdDesignationPrimary": {
"str_designame": "2012 DZ3"
}
},
"ra": 4.2016625345,
"dec": 0.46906823582,
"v_mag": 17.861642745,
"galactic_latitude": 47.610626908,
"total_error": 0.41790258945428654
},
{
"minorplanet": {
"h": 15.85,
"ast_number": 507156,
"designameByIdDesignationPrimary": {
"str_designame": "2009 YE"
}
},
"ra": 3.8855639992,
"dec": 0.19335541364,
"v_mag": 17.98367789,
"galactic_latitude": 57.755356977,
"total_error": 0.41284119038034706
},
{
"minorplanet": {
"h": 15.29,
"ast_number": 137427,
"designameByIdDesignationPrimary": {
"str_designame": "1999 TF211"
}
},
"ra": 2.1495107169,
"dec": 0.33297621067,
"v_mag": 17.537470682,
"galactic_latitude": 26.156793266,
"total_error": 0.2444217457795445
},
{
"minorplanet": {
"h": 15.1,
"ast_number": 377927,
"designameByIdDesignationPrimary": {
"str_designame": "2006 FZ36"
}
},
"ra": 4.0974112037,
"dec": -0.38582712304,
"v_mag": 17.752064416,
"galactic_latitude": 26.237041346,
"total_error": 0.17807965223649447
},
{
"minorplanet": {
"h": 17.93,
"ast_number": 236716,
"designameByIdDesignationPrimary": {
"str_designame": "2007 FV42"
}
},
"ra": 3.7052335519,
"dec": 0.19905006919,
"v_mag": 17.510841057,
"galactic_latitude": 65.905154914,
"total_error": 0.16758159021871333
},
{
"minorplanet": {
"h": 16.77,
"ast_number": 188443,
"designameByIdDesignationPrimary": {
"str_designame": "2004 GA34"
}
},
"ra": 4.280737306,
"dec": -0.29962058281,
"v_mag": 17.83691681,
"galactic_latitude": 22.590337027,
"total_error": 0.1537226535595067
},
{
"minorplanet": {
"h": 16.5,
"ast_number": 136864,
"designameByIdDesignationPrimary": {
"str_designame": "1998 FB41"
}
},
"ra": 4.2477889458,
"dec": -0.16742136427,
"v_mag": 17.135529627,
"galactic_latitude": 28.81309332,
"total_error": 0.15250422089947133
},
{
"minorplanet": {
"h": 16.04,
"ast_number": 147696,
"designameByIdDesignationPrimary": {
"str_designame": "2005 GB37"
}
},
"ra": 4.1347741942,
"dec": -0.31120809644,
"v_mag": 17.984421982,
"galactic_latitude": 27.992474028,
"total_error": 0.1370178040492703
},
{
"minorplanet": {
"h": 15.95,
"ast_number": 135853,
"designameByIdDesignationPrimary": {
"str_designame": "2002 SG52"
}
},
"ra": 4.2489796069,
"dec": -0.18259168979,
"v_mag": 17.329899696,
"galactic_latitude": 28.21899365,
"total_error": 0.13350909098093594
},
{
"minorplanet": {
"h": 12.89,
"ast_number": 32511,
"designameByIdDesignationPrimary": {
"str_designame": "2001 NX17"
}
},
"ra": 3.7070218468,
"dec": -0.41885585022,
"v_mag": 17.616869284,
"galactic_latitude": 35.505768033,
"total_error": 0.12792677633637672
},
{
"minorplanet": {
"h": 16.2,
"ast_number": 100908,
"designameByIdDesignationPrimary": {
"str_designame": "1998 KH17"
}
},
"ra": 3.775130044,
"dec": 0.11168614266,
"v_mag": 17.205079069,
"galactic_latitude": 59.573564041,
"total_error": 0.1237040934704294
},
{
"minorplanet": {
"h": 15.55,
"ast_number": 310630,
"designameByIdDesignationPrimary": {
"str_designame": "2002 BH19"
}
},
"ra": 4.2480139811,
"dec": 0.13522451622,
"v_mag": 17.920507974,
"galactic_latitude": 38.462682942,
"total_error": 0.12320668795323672
},
{
"minorplanet": {
"h": 16.12,
"ast_number": 213138,
"designameByIdDesignationPrimary": {
"str_designame": "2000 FY62"
}
},
"ra": 4.2490782037,
"dec": -0.19247271262,
"v_mag": 17.874683443,
"galactic_latitude": 27.859751998,
"total_error": 0.11274242130106618
},
{
"minorplanet": {
"h": 16.75,
"ast_number": 124192,
"designameByIdDesignationPrimary": {
"str_designame": "Moletai"
}
},
"ra": 4.1315597465,
"dec": -0.35608462501,
"v_mag": 16.948132539,
"galactic_latitude": 26.262408795,
"total_error": 0.11046997174058057
},
{
"minorplanet": {
"h": 15.3,
"ast_number": 168960,
"designameByIdDesignationPrimary": {
"str_designame": "2001 BQ19"
}
},
"ra": 3.4555170799,
"dec": -0.49821475484,
"v_mag": 17.898378988,
"galactic_latitude": 34.109386737,
"total_error": 0.10885948826905238
},
{
"minorplanet": {
"h": 15.94,
"ast_number": 82488,
"designameByIdDesignationPrimary": {
"str_designame": "2001 OO37"
}
},
"ra": 3.9749582291,
"dec": -0.54708347297,
"v_mag": 17.779985624,
"galactic_latitude": 22.722695024,
"total_error": 0.10732182937175537
},
{
"minorplanet": {
"h": 14.8,
"ast_number": 134287,
"designameByIdDesignationPrimary": {
"str_designame": "2006 CG60"
}
},
"ra": 4.25501114,
"dec": -0.15179699178,
"v_mag": 17.889549676,
"galactic_latitude": 29.043541329,
"total_error": 0.1056501032214559
},
{
"minorplanet": {
"h": 15.79,
"ast_number": 83239,
"designameByIdDesignationPrimary": {
"str_designame": "2001 RH51"
}
},
"ra": 3.8823456036,
"dec": -0.49725083856,
"v_mag": 17.958000231,
"galactic_latitude": 27.563664844,
"total_error": 0.10548160082141873
},
{
"minorplanet": {
"h": 15.31,
"ast_number": 116133,
"designameByIdDesignationPrimary": {
"str_designame": "2003 WO142"
}
},
"ra": 4.1394134005,
"dec": 0.016898202586,
"v_mag": 17.473723372,
"galactic_latitude": 40.124266578,
"total_error": 0.10370871534971296
},
{
"minorplanet": {
"h": 16.25,
"ast_number": 101168,
"designameByIdDesignationPrimary": {
"str_designame": "1998 SX2"
}
},
"ra": 4.4515992278,
"dec": -0.084644142934,
"v_mag": 17.52292536,
"galactic_latitude": 22.028277405,
"total_error": 0.10298226776122872
},
{
"minorplanet": {
"h": 14.57,
"ast_number": 221513,
"designameByIdDesignationPrimary": {
"str_designame": "2006 GY49"
}
},
"ra": 3.9996754594,
"dec": -0.54679292946,
"v_mag": 17.992092745,
"galactic_latitude": 22.058775199,
"total_error": 0.1020457551701532
},
{
"minorplanet": {
"h": 16.02,
"ast_number": 73865,
"designameByIdDesignationPrimary": {
"str_designame": "1997 AW"
}
},
"ra": 4.1591338813,
"dec": -0.42786067138,
"v_mag": 16.539614134,
"galactic_latitude": 22.269281446,
"total_error": 0.10071188048600664
}
]
}
}