Get data as of a specific time

You can use the as_of_time attribute in the mql envelope to get data that was present at a specific time.

this query:

{
 "q1" : {
   "as_of_time" : "2007-01-09T22:00:56.0000Z",
   "query" : [
     {
       "domain" : "/architecture",
       "id" : null,
       "return" : "count",
       "timestamp" : null,
       "type" : "/type/type"
     }
   ]
 }
}

returns 12 (there were 12 types in the /architecture domain last january).

{
 "q1": {
   "code": "/api/status/ok",
   "result": [
     12
   ]
 },
 "status": "200 OK",
 "code": "/api/status/ok"
}

this query (no as_of_time attribute):

 {
 "q1" : {
   "query" : [
     {
       "domain" : "/architecture",
       "id" : null,
       "return" : "count",
       "timestamp" : null,
       "type" : "/type/type"
     }
   ]
 }
}

returns the current number of types in the architecture domain:

 {
 "q1": {
   "code": "/api/status/ok",
   "result": [
     25
   ]
 },
 "status": "200 OK",
 "code": "/api/status/ok"
}

This example was extracted from a response on the developers@freebase mailing list.

One interesting use of this feature is to create a kind of trust authority application. Establish your own trusted view of topics by store the timestamp of a known good version. Then query to get the trusted version.

More information on as_of_time and other envelope parameters can be found in section 4.2.4 of the Complete MQL Reference Guide.

Search Help Center

Discussions

There are no conversations on this topic. Would you like to start one?

Start the Discussion »