Is DBPedia Spotlight still available? - semantic-web

I was playing around with NER of some texts, and came along DBPedia Spotlight.
However,
the website: http://spotlight.dbpedia.org/ is not accessable
the 2 demo: http://dbpedia-spotlight.github.io/demo/ and http://spotlight.dbpedia.org/demo/ seem not to work
the provided example url: http://spotlight.dbpedia.org/rest/spot/?text=Berlin&spotter=LingPipeSpotter%E2%80%99 doesn't work either
So is this service still available?
Are there any alternatives (I want to access it from PHP)?

I just learned that this machine is down. You can use the one under http://spotlight.sztaki.hu:2222/rest
You can curl it like this:
curl "http://spotlight.sztaki.hu:2222/rest/annotate?text=Michelle%20Obama%20called%20Thursday%20on%20Congress%20to%20extend%20a%20tax%20break%20for%20students%20included%20in%20last%20year%27s%20economic%20stimulus%20package,%20arguing%20that%20the%20policy%20provides%20more%20generous%20assistance.&confidence=0.2&support=20" -H "Accept:application/json"

Related

How to get all unread items using Feedly API

OK, either this is incredibly obvious and I'm just too dumb to see it, or it is not possible at all.
I created a Feedly developer access token and can call some end points just fine, like /profile, /categories, etc. Currently testing them with curl, but eventually will do this in Ruby.
What I can't find from the documentation (or even by Googling) is how to access all the unread entries from all my subscriptions just like I do in the Feedly app:
As far as I understand, Streams are for specific feeds. And the closest thing to the All stream, I think, is the Global Resource Id "global.all". But when I call it according to the documentation I get "API handler not found".
curl -H 'Authorization: OAuth [<MY_ACCESS_TOKEN>]' http://cloud.feedly.com/v3/user/<MY_USER_ID>/category/global.all
{"errorCode":404,"errorId":"ap5int-sv2.2018082612.1607238","errorMessage":"API handler not found"}
At some point I thought maybe Feedly just doesn't support this and went and looked at Inoreader's API documentation and it looks pretty much the same. There is no /All stream where I can pull my unread entries. So I feel like I'm missing something very obvious here.
What I am trying to do:
Basically I want to create an app for myself where I pull all my unread entries and flag the ones I'm interested in as "Read Later". This is part of a bigger workflow app that I'm working on.
You're almost there. To get a stream of all your unread articles, the syntax would be:
curl -H 'Authorization: OAuth <access token>' 'https://cloud.feedly.com/v3/streams/contents?streamId=user/<user id>/category/global.all&unreadOnly=true'
The <user id> can be obtained by the Profile API which can be found here.
The streams API is documented here.
Hope this helps.

Trouble with Google Custom Search API

Need: Search google via the API and get a json result that mimmics the result found when I search on the webapi
My Custom Search settings is to search the Entire Web
My search resutns:
Search Term: 072745546181 (which is a UPC label for some Chicken Breasts)
https://www.googleapis.com/customsearch/v1?key=AIzaSyBaPxycT3gj82T5qm66XGgIvtSEP31LISo&cx=015261035819156121642:qj7jmhlymjw&q=072745546181
Web search returns (see results)
Search Term: 072745546181 (which is a UPC label for some Chicken Breasts)
Example 1: https://www.google.de/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=072745546181
Notice the q= at the end is the same q=072745546181
There must be a simple answer, what am I doing wrong here?
Conversely, searching with terms like "Donald Trump President"
https://www.googleapis.com/customsearch/v1?key=AIzaSyBaPxycT3gj82T5qm66XGgIvtSEP31LISo&cx=015261035819156121642:qj7jmhlymjw&q=donald trump president
returns an okay result I can do something with. No problem here, but why when searching UPC's it fails?
What should I do?
Update 1.26.17 - Added 50 Point Bounty, I can make more. What is normal rate? Need some help!
This is a fascinating question. I just ran a series of tests that confirms that keywords are treated oddly if they contain more than 8 numerical digits (even if seperated by whitespace or hyphens). They are not simply ignored - because this SO page is found - but most websites are not returned. My best guess for this behaviour is it is a deliberate filter put in by google to restrict numerical searches to "trusted" websites in order to prevent phone number lookups. It might even be a more aggressive move to limit UPC, government records and patent lookups so automated tools can't compete with current or planned Google services that do the same.
I experimented with all sorts of tests including advanced operators like inurl%3A072745546181, allintitle%3A0727+4554+6181 and targeting sites that appear in the regular search like url%3Abuycott.com+072745546181 and the behaviour is consistent. It is so consistent that it has to be deliberate.
I'd say with 95% certainty you can't do what you want with Custom Search and it's highly unlikely Google will provide you a workaround.
I would suggest trying another search API provider, maybe Bing Web Search API or Faroo or one of these product search APIs
This is an old one, but still relevant. You have to create a custom search engine to look for UPCs here: https://cse.google.com/all
Once you do that, you need to add sites to search (e.g. https://www.barcodespider.com, https://www.upcitemdb.com)
From there, you cURL looks like this:
curl -X GET \
'https://www.googleapis.com/customsearch/v1?key={{googleApiKey}}&cx={{googleUpcSearchEngineCode}}&q=034449787178' \
-H 'Accept: */*' \
-H 'Cache-Control: no-cache' \
The request will filter the results by searching for the UPC within the sites specified.

How to get application uptime report with New Relic API ?

I need to get a weekly report of my applications uptime.
The metric is available on the "SLA Report" screen (http://awesomescreenshot.com/0f02fsy34e) but i can't find a way to get it programatically.
Other SLA metrics are available using the API : http://docs.newrelic.com/docs/features/sla-report-examples#metrics
The uptime information is not considered a metric so is not available via the REST API. If you like you may contact support.newrelic.com to request this as a new feature.
Even though there was no direct api request for getting uptime from newrelic we can give the nrql queries inside curl.
curl -X POST -H "Accept: application/xml" -H "X-Query-Key: your_query_api_key" -d "nrql=SELECT+percentage(count(*)%2c+WHERE+result+%3d+'SUCCESS')+FROM+SyntheticCheck+SINCE+1+week+ago+WHERE+monitorName+%3d+'your+monitor+name'+FACET+dateOf(timestamp)" "https://insights-api.newrelic.com/v1/accounts/your_account_id/query"
The above curl will give uptime percentages distributed by Days of week. If you don't know how to url encode your nrql query please try this http://string-functions.com/urlencode.aspx. Hope this helps.
mm. I figured out that the following gives a csv formatted text content and could be useful for extracting data (monthly), but it's not going ask you for credentials on the tool / command line you use. (Beware). Since i export the monthly metrics from my machine, it's simple for me to make it work, and it really gives me much more flexibility.
https://rpm.newrelic.com/optimize/sla_report/run?account_id=<account_id>&application_id=<app_id>&format=csv&interval=months

Retrieving multiple articles & images via the new Freebase API

I want to get the article text & images for a bunch of topics from freebase. Using the old API this was easy, via either MQL extensions or the topic API (also now deprecated?). But what is now the best way of doing this via the new API?
I see from the docs I can get the text for an individual topic, like this:
https://www.googleapis.com/freebase/v1/text/en/bob_dylan
So I could loop through each topic one by one, but it seems slow to have to hit the API so many times, especially when I only needed one before. Am I missing some clever way of retrieving text / images for multiple topics?
Cheers,
Ben
It is possible to do multiple calls for /text using JSON-RPC - http://en.wikipedia.org/wiki/JSON-RPC
Here's an example:
curl "https://www.googleapis.com/rpc" -d "[{'method': 'freebase.text.get', 'apiVersion': 'v1', 'params': {'id': ['en','bob_dylan']}},{'method': 'freebase.text.get', 'apiVersion': 'v1', 'params': {'id': ['en','blade_runner']}}]" -H "Content-Type: application/json"
We are working on improving our documentation for doing this but this should get you going.
The name of the method you want to call is freebase.text.get and the rest of the parameters are documented here:
http://wiki.freebase.com/wiki/ApiText#Parameters
You can pass the id using an "id" parameter.
What exactly are you looking for for images ? How would you get back multiple binary content ?

REST API for driving distance?

Is there a service that will give me the driving distance between two addresses? Apparently Google Maps API requires you to display a map, which I don't want to do (on that particular page), and I'd like to just snag the data and save it to my DB after a user submits a form, rather than waiting for JS to do it's thing.
If it's relevant, this is going into a Django app. I discovered that CloudMade offers a Python API, which is nice, except their latest dev release has a bug in it (can't use the API object), but more importantly, it's support for Canada is awful (couldn't find directions from any major city around here!).
MapQuest's Directions API is HTTP Querystring based (I'm not sure if it's entirely RESTful). Can get XML or JSON response. Just need to send it an HTTP GET Request.
http://developer.mapquest.com/web/products/open/directions-service
Use the "distance" response parameter.
I don't have a high enough reputation on SO to comment on an answer but I just wanted to be clear that contrary to the voted correct answer, Google Directions API has to adhere to the Google Maps API. If you scroll down the supplied link, you will see:
Note: the Directions API may only be used in conjunction with displaying results on a Google map; using Directions data without displaying a map for which directions data was requested is prohibited. Additionally, calculation of directions generates copyrights and warnings which must be displayed to the user in some fashion. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.
Would it be possible to use Google Maps GDirections object? This can return the textual directions instead of the map overlay if called with a div object. From there you can use the getDistance (or getDuration) functions. You can always use an invisible div for the returns if you don't want anything to be displayed on the page.
Start here
http://code.google.com/apis/maps/documentation/examples/directions-advanced.html
http://code.google.com/apis/maps/documentation/reference.html#GDirections
And use this sample code
var map;
var directionsPanel;
var directions;
function initialize() {
directionsPanel = document.getElementById("route");
directions = new GDirections(null, directionsPanel);
GEvent.addListener(directions , "load", onGDirectionsLoad);
directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)");
}
function onGDirectionsLoad(){
alert(directions.getDistance().html);
}
Here is my solution:
Signup for Mapquest Developer network.
Get AppId
Open your command shell and run the following command(or use fiddler) But running it through curl will give you flexibility to automate your request
curl -X POST -H "Content-Type: application/json" -d '{locations: ["Salt Lake City, UT","Ogden, UT",],options: {allToAll: false}}' http://www.mapquestapi.com/directions/v2/routematrix?key=YOURKEYGOESHERE >> distance.txt
Save above command with all your destinations into batch or sh file.
Now grep and parse out your distance.txt file for what you need.
There are free services out there, but the quality of the data may be questionable/non-existent in areas. Be aware of licences on the data too, storing in your own DB may be a breach.
http://openrouteservice.org/
Take a look at Navteq. I used their service in developing a driving directions application about 5 years ago, and got good results. Can't speak for them lately though. I believe the best URL is Navteq Routing Service
You can use the new Google Directions API directly, without using any javascript.
http://code.google.com/apis/maps/documentation/directions/