elixirrdfelixir-mixelixir-iex

undefined function sigil_I/2 (there is no such import)


I am working on RDFGraph using elixir. I am running the following command on iex:

iex(1)> DC.format(~I<urn:isbn:978-1-68050-252-7>, ~L"Paper")

and get this error:

** (CompileError) iex:1: undefined function sigil_I/2 (there is no such import)

The function "sigil_I" is present in RDF git repository, which is imported in the book function using import RDF.Sigils. The DC.format function is present in the following file:

defmodule RDFGraph.Vocab do
  use RDF.Vocabulary.Namespace

  alias RDF.NS.XSD

  defvocab(DC,
    base_iri: "http://purl.org/dc/elements/1.1/",
    file: "dc.ttl"
    # terms: ~w[
    #   contributor coverage creator date description format
    #   identifier language publisher relation rights source
    #   subject title type
    # ]
  )

  defvocab(BIBO,
    base_iri: "http://purl.org/ontology/bibo/",
    file: "bibo.ttl",
    case_violations: :ignore
  )

  defvocab(DCTERMS,
    base_iri: "http://purl.org/dc/terms/",
    file: "bibo.ttl",
    case_violations: :ignore
  )

  defvocab(EVENT,
    base_iri: "http://purl.org/NET/c4dm/event.owl#",
    file: "bibo.ttl"
  )

  defvocab(FOAF,
    base_iri: "http://xmlns.com/foaf/0.1/",
    file: "bibo.ttl"
  )

  defvocab(PRISM,
    base_iri: "http://prismstandard.org/namespaces/1.2/basic/",
    file: "bibo.ttl"
  )

  defvocab(SCHEMA,
    base_iri: "http://schemas.talis.com/2005/address/schema#",
    file: "bibo.ttl"
  )

  defvocab(STATUS,
    base_iri: "http://purl.org/ontology/bibo/status/",
    file: "bibo.ttl",
    case_violations: :ignore
  )

  ## book function defintions

  # START:book
  def book() do

    import RDF.Sigils
    alias RDF.NS.{XSD}

    ~I<urn:isbn:978-1-68050-252-7>
    |> RDF.type(BIBO.Book)
    |> DC.creator(
      ~I<https://twitter.com/bgmarx>,
      ~I<https://twitter.com/josevalim>,
      ~I<https://twitter.com/redrapids>
    )
    |> DC.date(RDF.date("2018-03-14"))
    |> DC.format(~L"Paper")
    |> DC.identifier(~L"adopting_elixir")
    |> DC.identifier(RDF.literal("urn:isbn:978-1-68050-252-7",
        datatype: XSD.anyURI()))
    |> DC.publisher(~I<https://pragprog.com/>)
    |> DC.title(~L"Adopting Elixir"en)
  end
  # END:book

  def book_long() do

    alias RDF.NS.{XSD}

    s = RDF.iri("urn:isbn:978-1-68050-252-7")

    t0 = {s, RDF.type(), RDF.iri(BIBO.Book)}
    t1 = {s, DC.creator(), RDF.iri("https://twitter.com/bgmarx")}
    t2 = {s, DC.creator(), RDF.iri("https://twitter.com/josevalim")}
    t3 = {s, DC.creator(), RDF.iri("https://twitter.com/redrapids")}
    t4 = {s, DC.date(), RDF.literal("2018-03-14", datatype: XSD.date())}
    t5 = {s, DC.format(), RDF.literal("Paper")}
    t6 = {s, DC.identifier(), RDF.literal("adopting_elixir")}
    t7 = {s, DC.identifier(), RDF.literal("urn:isbn:978-1-68050-252-7", datatype: XSD.anyURI())}
    t8 = {s, DC.publisher(), RDF.iri("https://pragprog.com/")}
    t9 = {s, DC.title(), RDF.literal("Adopting Elixir", language: "en")}

    RDF.Description.new([t0, t1, t2, t3, t4, t5, t6, t7, t8, t9])
  end

end

This file is present in an RDFGraph app having the following structure: enter image description here

The DC.format function is in rdf_graph/lib/rdf_graph/vocab.ex. This file is given above. Not sure why this function is being called and I am getting this error, any help would be appreciated. Thanks!


Solution

  • I resolved this issue by first running import RDF.Sigils then alias RDFGraph.Vocab.{DC, BIBO, DCTERMS, EVENT, FOAF, PRISM, SCHEMA,STATUS} commands, in the iex command line.