Cannot use SPARQL_Client inside of phoenix

Hey everyone

I don’t know if it’s me or if it’s a problem with the library (SPARQL_Client) or with phoenix, but I want to query http://dbpedia.org/sparql

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select DISTINCT ?resource ?p ?value where {
 ?resource rdfs:label "Shopping"@en.
 ?resource ?p ?value
}

So I’m trying in elixir to set this up

import SPARQL
"""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?resource ?p ?value where {
 ?resource rdfs:label "screen"@en.
 ?resource ?p ?value
}
"""

|> SPARQL.Client.query("http://dbpedia.org/sparql")

if I try this with iex -S mix in the freshly cloned SPARQL_Client Repository it works fine.

but when I try this in the phoenix environment it does not work.

Instead I get {:error, "unsupported result format for select query: \"text/html; charset=UTF-8\""} as an error

I hope someone can help me.

I figured it out with the help from the developer:

I had to replace the the default HTTP-Client.

config :tesla, :adapter, Tesla.Adapter.Hackney did it for me

2 Likes