未定义的函数 sigil_I/2 (没有这样的导入)

发布于 2025-01-17 21:48:25 字数 3316 浏览 1 评论 0原文

我正在使用 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 存储库中,该存储库是在 book< 中导入的/code> 函数使用 import RDF.SigilsDC.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 应用程序中: 在此处输入图像描述

DC.format 函数位于 rdf_graph/lib/rdf_graph/vocab.ex 中。该文件在上面给出。不知道为什么调用这个函数并且我收到此错误,任何帮助将不胜感激。谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隐诗 2025-01-24 21:48:25

我首先运行import rdf.sigils然后别名rdfgraph.vocab。在iex命令行中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文