Skip to content

Support language-tagged literals from DataFrame columns in template mapping #43

@henrieglesorotos

Description

@henrieglesorotos

Static Literal objects with language tags work correctly in template instances as far as I can see

  static_label = Literal('Static Label', language='en')
  Triple(subject, predicate, static_label)  # -> Produces "Static Label"@en

However, there's no way to produce language-tagged literals for dynamic values from DataFrame columns.

What works:

Static literal in template - produces "Static"@en

Triple(subject, predicate, Literal('Static', language='en'))

What doesn't work:

  1. Literal objects in DataFrame:
df = pl.DataFrame({'label': [Literal('Dynamic', language='en')]})
Result: MaplibException: Datatype error 'Unknown datatype Binary'
  1. RDFType.Literal with language parameter:
Parameter(variable=label_var, rdf_type=RDFType.Literal(language='en'))
Result: TypeError: RDFType.Literal() got an unexpected keyword argument 'language'

I might be doing something really stupid? 😭

Environment:

  • maplib version: 0.18.13
  • Python: 3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions