Socrata does it support startswith or endswidth on a column - socrata

Currently socrata only supports
https://soda.demo.socrata.com/resource/4tka-6guv?region=Victoria Islands region&source=pr
Is there an option to find the region's StartsWith Victoria?

We do not have a direct startsWith function but there are ways to derive the same results. Try https://soda.demo.socrata.com/resource/4tka-6guv.json?$q=Victoria. Note that this would also return results where Victoria appears within the field, not necessary at the beginning of an entry.

Related

Jora name with Dots

I am using the Chrome plugin JsonDiscovery that use JORA to Query in JSON and make JSON query. But know when I consult the MS DevOps API that return the fields with dots in the name I coldnt make the query because JORA understand the dot like to get the next field in the hierarchic.
{
Microsoft.VSTS.Common.ValueArea: "Business",
Microsoft.VSTS.Scheduling.Effort: 40,
Microsoft.VSTS.Scheduling.StartDate: "2021-01-11T03:00:00Z",
}
Dows Someone know how I can make the query with those dots in the name ?
When a property has forbidden chars for an identifier, you should use the same approach as in JavaScript, i.e. $['Microsoft.VSTS.Common.ValueArea'].
For Jora foo['bar'] is the same as foo.bar. However, in first case you can use any chars for a property name, but the second one is faster to type and easier to read.
After many times debugging the Jora, I found the pick method.
..pick("Microsoft.VSTS.Common.ValueArea")

Fiware Context Brocker How to query entities with not equal condition to its ID

lets assume I have three Room entities with ids
urn:ngsi-Id:Room:Room1,
urn:ngsi-Id:Room:Room2,
urn:ngsi-Id:Room:Room3
Now I want to query all entities where id not equal urn:ngsi-Id:Room:Room2.
How I can do this?
Try
GET /v2/entities/?q=id!=Room2
Try:
GET /v2/entities?idPattern=Room[^2]
This is not perfect (for instance, it assumes your have from Room0 to Room9, but with two-digits suffixes it may not work as expected) but the exact regex lays out of the scope of this answer (which is about the Orion API).
There is a lot of literature about regex expression out there and debugging tools (as this one: https://rubular.com/)

Using property OR in "conditions" parameter of askargs action with Semantic MediaWiki API

I'm trying to fetch results via API using the module askargs. I have no problems getting results when I have just one condition or more conditions aggregated with the operator AND where I make use of the pipe character to separate them (like written in documentation).
E.g.
[[Category:+]] AND [[Jurisdiction::A]] AND [[Type::B]]
Category:+ | Jurisdiction::A | Type::B
But the pipe character doesn't work with OR.
I need to be able to use both logical conditions with several arguments within the same query.
Am I missing something?
Am I missing something?
No. The API doesn't handle OR condition, due to simplistic code in the query parameters formatter.
See file SemanticMediaWiki/src/MediaWiki/Api/ApiRequestParameterFormatter.php
at line 132:
protected function formatConditions( $condition ) {
return "[[$condition]]";
}
Every condition in the query is formatted with surrounding brackets, leading OR to be interpreted as a page title.
An alternative is to use Special:Ask with URL encoded query and json format:
https://www.semantic-mediawiki.org/wiki/Special:Ask/-5B-5BHas-20keyword::askargs-5D-5DOR-5B-5BHas-20keyword::ask-5D-5D/-3F%3Dhelp-20page/-3FHas-20description%3Ddescription/format%3Djson
Since I came here from a website search i'm going to add another neat possibility:
If you use the Alternative separator you can use a double pipe as logical OR conjunction.
Example:
%1FCategory:+%1FJurisdiction::A%1FType::B||C
Which should be read as following
Category:+ AND Jurisdiction::A AND (Type::B OR Type::C)

Google Maps geocoding API component restriction

I'm using the Google Maps Geocoding API web service, and I'm using the components parameter to restrict results to 'London'. My URL query is here:
https://maps.googleapis.com/maps/api/geocode/json?address=<address>&components=administrative_area:london, united kingdom
This works super well and I only get results which are within London. However, if I ask for something definitely not in London, (e.g 'Manchester'), I simply get a default return relating to 'Greater London'. I would rather it simply returns the ZERO_RESULTS status. Is there a way to specify this?
P.S I have tried to use the region parameter, but this isn't as tight as I want it to be.
Using information found on https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering
You can filter by a city (locality) and country as two separate filter components and these can be separated by the pipe (|) symbol. The country is the ISO 3166-1 country code [https://en.wikipedia.org/wiki/ISO_3166-1] therefore GB in order to cover the city of London.
Therefore, this format could be used :
https://maps.googleapis.com/maps/api/geocode/json?address=<address>&components=locality:London|country:UK
With that in mind, and addressing your exact question, according to
https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering
Filter values support the same methods of spelling correction and
partial matching as other geocoding requests. If a geocoding result is
a partial match for a component filter it will contain a partial_match
field in the response.
So it seems it will always try to find partial match when there are no exact matches and this cannot be disabled unfortunately.
However, if you do a check for "partial_match" : true in the result set, you could filter out such results in your code that deals with the response.
In Summary
This format seems to give results without "partial_match" : true if the address is ‘good’
https://maps.googleapis.com/maps/api/geocode/json?address=<address>&components=locality:London|country:UK
And it will allow you to filter the response for "partial_match" : true in your code to exclude spurious results. For example, using an address 'Manchester' :
https://maps.googleapis.com/maps/api/geocode/json?address=Manchester&components=locality:London|country:UK

Regex Select numeric string between elements

I have been searching stack and Google and have figured out some of what I'm trying to do. Here is the string
?w=2796&
I need to get the numerics between w= and &
So it should return w=2796
Here's what I have so far: w=(.*?)&
This does work but is returning the &
Is there a way to to return only w=numeric
This regex is also returning some other elements which I don't need in the HTML in some instances.
It's going to depend on which regex engine you use. & may have special meaning. I think the simplest approach here is something like /w=(\d+)/ or /w=([0-9]+)/ assuming no negatives or decimals in your numbers