Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
DBpedia Spotlight Web Service example call
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