和其它的许多小精灵步骤一样,math步骤也可以和一个或多个by调节器一起使用。首先我们看一个简单查询的例子。检查SAF机场的跑道数,和所有您从那出发能到达的机场的跑道数。
As with many Gremlin steps, a math step can also be combined with one or more by modulators.
First of all let’s write a simple query to inspect the number of runways and Santa Fe (SAF) and all of
the places that you can fly to from there.
现在我们稍对查询语句做些修改,将每对机场的跑道的数量相加。
Now let’s modify the query to use a math step to add the number of runways each pair of airports
has.
当然,这只是一个例子,实际上不需要数学运算,但是希望这个例子可以帮助您理解在math步骤中如何使用by调节器。出于完整性,使用sum步骤重写这个查询。注意这个例子中,结果是整数,而在使用math步骤的查询中,返回的结果总是浮点数。
Of course, this is a simple example where math is not really needed but hopefully it shows how a by
modulator can be used with a math step. For completeness, here is the query rewritten to use a sum
step. Notice that in this case the results are integers whereas the math step always returns floating
point values.
浙公网安备 33010602011771号