Skip to content

Consider updating prefixes and base definitions and representations in SXP #20

@gkellogg

Description

@gkellogg

Is your feature request related to a problem? Please describe.
Coming from SPARQL, if a sub-expression containing a URI with a lexical representation using a prefix or base definition is extracted, the to_sxp method will use that representation even if the prefix or base definition is no longer included.

Describe the solution you'd like
A method for managing prefix and base definition within an S-Expression (SPARQL-specific) which would recursively update the lexical representations of embedded URIs (including literal datatypes) would be nice.

# Possible refinements

# Adds a prefix declaration to an Array representation of an S-Exp and recursively update the lexical representations of contained URIs
def add_prefix(pfx, uri); end

# Adds a prefix declaration to an Array representation of an S-Exp and recursively update the lexical representations of contained URIs
def add_base(uri); end

# Returns a deep copy of an Array representation of an S-Exp without  the specified prefix and removes any lexical representations from included URIs recursively
def remove_prefix(pfx); end

# Returns a deep copy of an Array representation of an S-Exp without  the specified base and removes any lexical representations from included URIs recursively
def remove_base(); end

# Returns a deep copy of an Array representation of an S-Exp without any prefix or base declarations.
def clear_prefixes; end

# Return the prefix definitions from an an Array representation of an S-Exp
def prefixes; end

Additional context
See the email thread at https://lists.w3.org/Archives/Public/public-rdf-ruby/2021Dec/0014.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions