undefined function sigil_I/2(没有这样的导入)

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

我正在使用 elixir 处理 RDFGraph。 我是 运行 iex 上的以下命令:

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

并得到这个错误:

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

函数 "sigil_I" 存在于 RDF git 存储库中,它是使用 import RDF.Sigilsbook 函数中导入的。 DC.format 函数存在于以下文件中:

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

此文件存在于具有以下结构的 RDFGraph 应用程序中: enter image description here

DC.format 函数在 rdf_graph/lib/rdf_graph/vocab.ex 中。上面给出了这个文件。不确定为什么调用此函数并且出现此错误,我们将不胜感激。谢谢!

我在 iex 命令行中先 运行 import RDF.Sigils 然后 alias RDFGraph.Vocab.{DC, BIBO, DCTERMS, EVENT, FOAF, PRISM, SCHEMA,STATUS} 命令解决了这个问题。