Skip to content

RDF/XML Parser does not use node id's when supplied #751

@DJ1TJOO

Description

@DJ1TJOO

e.g.:

<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:exa="http://example.com/"
 xmlns:foaf="http://xmlns.com/foaf/0.1/">
    <foaf:Organization rdf:about="http://example.com/org1">
        <exa:member rdf:nodeID="n0" />
        <exa:member rdf:nodeID="otherNodeId" />
    </foaf:Organization>
</rdf:RDF>

When parsed will produce a generated id for both.

Related code:

this.node = this.parser.bnodes[id] = this.store.bnode()

Suggested fix:
Use id found on node, if it was not generated. A generated id is any id that matches the n${number} syntax

this.node = this.parser.bnodes[id] = this.store.bnode(/n[0-9]+$/.test(id) ? undefined : id)

After this suggestion "otherNodeId" is kept while "n0" uses the generated ids, which possible may change.

Should the check also make sure id is a Non-Colonized Name?

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