Skip to content

Optionally have ldpath return RDF::Literals instead of Strings #16

@elrayle

Description

@elrayle

Description

An ldpath program can request a result in a specific language, but if language is not specified, all literals will be returned for all languages. Since the results are returned as strings, the language tagging is lost. This prevents the caller from processing the results based on language.

This can be ameliorated by allowing the #evaluate method to have an optional parameter requesting that results be returned as RDF::Literals instead of Strings.

Rationale

Callers of ldpath may want to get all possible values for all languages and have language specific processing in the calling app.

Use Case

Ldpath is used to get values for two related properties. Each property's values are sorted by language making the two sets of property results align by language.

The values can be requested by language, but that assumes you know in advance all the possible languages.

NOTE: This sorting is happening in the calling app. Without language tagging, this type of sorting cannot be done.

Desired Ordering

term = ["dried milk", "getrocknete Milch", "lait en poudre"]
desc = ["powdery", "Pulverförmig", "poudreux"]

Undesired Ordering

term = ["dried milk", "getrocknete Milch", "lait en poudre"]
desc = ["poudreux", "powdery", "Pulverförmig"]

Expected Results

results = ldpath_program.evaluate(subject_uri, context: graph, limit_to_context: true, literal_results: true)
results # [RDF::Literal<"milk"@en>, RDF::Literal<"milche"@de>, RDF::Literal<"lait"@fr>]

Actual Results

literal_results is not a parameter in the current implementation

results = ldpath_program.evaluate(subject_uri, context: graph, limit_to_context: true)
results # ["milk", "milche", "lait"]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions