Created
May 18, 2012 10:46
-
-
Save maxjakob/2724633 to your computer and use it in GitHub Desktop.
DBpedia Spotlight Web Service example call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val exampleText = "Residential Search List Page - Mortgage advice from SPF, WT.conv, Mortgage Advice From SPF, WT.tx_e, conv, WT.dl, 85], selector:a[href*=mortgages]}]}," | |
val urlEncoded = java.net.URLEncoder.encode(exampleText, "utf-8") | |
val url = new java.net.URL("http://spotlight.dbpedia.org/rest/annotate") | |
val data = "text=" + urlEncoded + "&support=10&confidence=0.2" | |
val conn = url.openConnection | |
conn.setDoOutput(true) | |
val out = new java.io.OutputStreamWriter(conn.getOutputStream) | |
out.write(data) | |
out.flush | |
out.close | |
val in = conn.getInputStream() | |
println(io.Source.fromInputStream(in).mkString("")) | |
in.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment