这是indexloc提供的服务,不要输入任何密码
Skip to content

Parsing an IRI field that is not an IRI generates a local absolute path #3305

@vemonet

Description

@vemonet

I noticed that when we provide a string that is not a IRI to a field that is expected to be an IRI then RDFLib generates an IRI using

e.g. for this JSON-LD (schema.org defines license as an IRI)

{
  "@context": "http://schema.org",
  "license": "notspecified"
}

After parsing and serializing back to turtle I get (path being the current path):

schema:license <file:///Users/vemonet/dev/notspecified> ;

It seems a bit like a hacky behavior to generate the IRI. Is this really needed? In which use-case is this actually relevant to have this behavior?

What could be a better behavior?

  • Throw an error? Arguably the RDF we try to parse is faulty, and for reliability throwing an error would be better than silently altering the underlying data (there could be a strict=True param on the parser), which can cause many more problem down the road
  • Use a named blank node instead of an IRI (I am not a big fan of blank nodes though...)
  • Generates an IRI without using the absolute current working directory path

I can look into this and implement the changes if ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions