# Installation

The RDF.ex Hex package (opens new window) can be installed as usual, by adding rdf to your list of dependencies in mix.exs:

def deps do
  [
    {:rdf, "~> 2.1"}
  ]
end

If you want to read or write JSON-LD (opens new window), you also have to add json_ld to your dependencies for the separate JSON-LD.ex (opens new window) package. If you want to read or write RDF-XML (opens new window), you have to add rdf_xml to your dependencies for the separate RDF-XML.ex (opens new window) package.

def deps do
  [
    {:rdf, "~> 2.1"},
    {:rdf_xml, "~> 1.2"},
    {:json_ld, "~> 1.0"},
  ]
end

# HTTP client configuration

JSON-LD.ex uses Tesla (opens new window), an abstraction over different HTTP client libraries. This allows you to use the HTTP client of your choice, as long as a Tesla adapter exists. Currently httpc, hackney (opens new window) or ibrowse (opens new window), gun (opens new window), mint (opens new window) and finch (opens new window) are supported. See this list (opens new window)

Without further configuration, the built-in Erlang httpc is used.

WARNING

It is strongly advised to use one of the alternatives, since httpc has a lot of issues (opens new window) and will very likely cause troubles sooner or later.

If you want to use another client library, you'll have to add it to your list of dependencies in mix.exs and configure Tesla to use it.

So, for hackney you'll have to add hackney to mix.exs:

def deps do
  [
    {:json_ld, "~> 1.0"},
    {:hackney, "~> 1.6"}
  ]
end

and add this line to your config.exs file (or environment specific configuration):

config :tesla, :adapter, Tesla.Adapter.Hackney