How to write a query with two requirements in overpass turbo? - openstreetmap

I am trying to retrieve a bus route for specific bus services. How do I include two key in overpass query such that I could find the bus routes of specific bus services? For example, I would like to find the bus routes of bus Svc 3 ?
How do I include two features:
"route" = "bus"
"name" = "Svc 3"
QUERY
node["route"="bus",](around:{{radius}},{{geocodeCoords:'country'}});
way["route"="bus"](around:{{radius}},{{geocodeCoords:'country'}});
relation["route"="bus"](around:{{radius}},{{geocodeCoords:'country'}});

See the documentation of the query statement. To specify multiple filters just add them one after the other:
relation["route"="bus"]["name"="Svc 3"](around:{{radius}},{{geocodeCoords:'country'}});

Related

Querying multiple timeseries using Stackdriver/Cloud Monitoring Rest API

I am trying to use the Google Cloud monitoring REST APIs to get timeseries data of my project. I have been looking at the documentation here: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list
I do not see any API where I can query for multiple timeseries (with different filters each) using one single REST call. Is that possible with the available APIs ?
For example, for a given timerange, I might want to get the kubernetes/cpu/usage metric with certain filters and the kubernetes/memory/usage metric with a different set of filters in one single REST API call.

Openapi spec design for network equipment

I'm working on some API service which consume REST queries (CRUD operations) and send appropriate CLI commands to some network equipment.
There is 2 possible ways to design Openapi specification for this service:
Detailed huge API spec. Describe exactly all the endpoints, all the schemas, all the params that exist in the network equipment CLI. I think specification will be about 100K of lines in this way. Specification can be autogenerated based on device CLI parsing (using ? and TAB keys).
Generalized tiny API spec. Hide all device configuration details in a few common parameters. Something like
paths:
/api/{CLI_endpoint}: # we say "CLI_endpoint" instead of describing all the endpoints
...
post:
requestBody:
content:
application/json:
schema:
type: object # we say "object" instead of describing all the params
In this way we simply say that all the endpoint names and param names correspond to network equipment CLI documentation.
Which of the ways will be better?

How to store locations in ArangoDB?

I am building a web application where I need to store a large number of unique addresses as nodes in ArangoDB.
One approach would be using a hierarchical graph model: a country node connected to county nodes, county nodes connected to cities and cities connected to exact addresses with GeoJSON attributes.
The other option would be having only address nodes which contain city, county and country as attributes.
Which method would be more beneficial? I would be running queries to find locations in a given range or locations in a given city.
Well, let's see what you will need in terms of collections to build your app:
Collection storing the Places you want to use in your app. This would be your main collection and would contain among other things a map location object {longitude: XXX, Latitude YYY}
Because you probably want people to be able to search by city, country, etc.. You need either a collection per Location type (city, country, etc) or a table with all the locations and a "type" flag that indicates the location is city or country, etc....
3.- You need a table that allows you to start at a country and drill down to a particular set of cities (for example). So, you need a table with a from key and a to key
By this point you probably have noticed that we have basically built a hierarchy, which in Arango I would build as at least one Places vertex collection, a Locations vertex collection and a locationContains edge collection. This would allow for really fast lookups and is one of the reasons why graph databases were originally created.
Now note that since Arango is a multi model DB, you can use the graph syntax (I like anonymous graph syntax myself), but you can also use traditional joins whenever needed, which behave very similar to a traditional relational DB.

Magnolia REST API

Is there any way to request Magnolia REST API for list of products
which could be retrieved with equivalent of JCR SQL2
select * from [mgnl:product] where productName like '%Nikon%'
If it's only possible with custom rest end-point could you please point to tutorial.
Update as of Magnolia REST 2.1, using the v2 endpoint definition:
To answer the second question about node-types, here's what it looks like, as a YAML file in a light module, e.g. <module-name>/restEndpoints/delivery/my-products_v1.yaml:
class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
workspace: products
rootPath: /
includeSystemProperties: false
bypassWorkspaceAcls: true
depth: 2
nodeTypes:
- mgnl:product
childNodeTypes:
- mgnl:contentNode
The Delivery endpoint config takes node-types to include.
nodeTypes specify the primary list of JCR node types to query—in your case mgnl:product;
childNodeTypes specify which child-nodes to include as JSON objects under the primary results, when depth is greater than 0.
With the above configuration, you may run the following requests to query products or get a single product, respectively:
GET <host>/.rest/delivery/my-products/v1?productName[like]=%25Nikon%25
GET <host>/.rest/delivery/my-products/v1/path/to/Nikon-1
This differs from Magnolia's former Nodes endpoint, which is not configurable, but only lets consumers exclude node-types.
Yes, you can use content delivery endpoint to do so. Syntax is like: GET /delivery/{endpoint-prefix}/v1?key1=value1&key2=value2
See https://git.magnolia-cms.com/projects/MODULES/repos/rest/browse/magnolia-rest-content-delivery for more details.

FIWARE Orion: complex entities

I would like to create some complex entities, aggregating the results of some simpler entities.
Example scenario: model a room with its temperature.
I have 3 temperature sensors in a room.
I create under Orion 3 "Sensor" entities with a "Temperature" attribute.
I would also like to create a "Room" entity, which contains a consolidated temperature value (says the average of the 3 sensors).
How to do that? Can I use Perseo (http://fiware-iot-stack.readthedocs.io/en/latest/cep/)? The idea is to create a rule on Perseo that will update the attribute value of the room based on the sensor entity values.
Maybe you can model your scenario with FIWARE Comet STH.
One of the use possibilities is:
Aggregated time series context information: The STH component allows the query and retrieval of historical aggregated time series context information, this is information about the evolution of the entity attribute values grouped by time making it straight-forward to get distinct probabilistic measures such as means, standard deviations, maximum and minimum values, as well as the number of occurrences.
This way, you can get the average of the three sensors.
In order to update your Room entity, I think you can register a notification with a url pointing to your Room entity at Orion and use custom headers to specify the headers needed to make the notification works updating your entity.
The following link can help you about custom headers:
How to add a custom header in outgoing notifications with Orion?
I hope this can help you.