Closed
Bug 466378
Opened 16 years ago
Closed 16 years ago
rdf:nodeID not working when node appears as object before as subject in RDF/XML source
Categories
(Core Graveyard :: RDF, defect)
Core Graveyard
RDF
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.9.1b3
People
(Reporter: mininet, Assigned: mininet)
References
(Blocks 1 open bug)
Details
(Keywords: fixed1.9.1)
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
axel
:
review+
shaver
:
superreview+
beltzner
:
approval1.9.1+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.3) Gecko/2008092816 Iceweasel/3.0.3 (Debian-3.0.3-3)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
The RDF parser generates anonymous resources when it sees "rdf:nodeID".
This works properly when a <rdf:Description rdf:nodeID="foo"> appears in the file before the id "foo" is referenced. Yet, when the rdf:nodeID appears as the object of a predicate before being described in a <rdf:Description>, the parser generates two different resources for the same identifier.
Such an input is valid according to the RDF spec, see the section about nodeID: http://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-blank-nodes
I think this should block bug 11650.
Reproducible: Always
Steps to Reproduce:
1. Load the following data (example from the RDF spec):
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/">
<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar"
dc:title="RDF/XML Syntax Specification (Revised)">
<ex:editor rdf:nodeID="abc"/>
</rdf:Description>
<rdf:Description rdf:nodeID="abc"
ex:fullName="Dave Beckett">
<ex:homePage rdf:resource="http://purl.org/net/dajobe/"/>
</rdf:Description>
</rdf:RDF>
2. Serialize it with "ds.FlushTo(...)".
Actual Results:
For the moment, FlushTo writes the following file. Note the different resources "rdf:#$Y+Ujz3" and "rdf:#$X+Ujz3".
<?xml version="1.0"?>
<RDF:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ex="http://example.org/stuff/1.0/"
xmlns:NC="http://home.netscape.com/NC-rdf#"
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description RDF:about="rdf:#$Y+Ujz3"
ex:fullName="Dave Beckett">
<ex:homePage RDF:resource="http://purl.org/net/dajobe/"/>
</RDF:Description>
<RDF:Description RDF:about="http://www.w3.org/TR/rdf-syntax-grammar"
dc:title="RDF/XML Syntax Specification (Revised)">
<ex:editor RDF:resource="rdf:#$X+Ujz3"/>
</RDF:Description>
</RDF:RDF>
Expected Results:
We should get instead something like that:
<RDF:Description RDF:about="rdf:#$X+Ujz3"
ex:fullName="Dave Beckett">
<ex:homePage RDF:resource="http://purl.org/net/dajobe/"/>
</RDF:Description>
<RDF:Description RDF:about="http://www.w3.org/TR/rdf-syntax-grammar"
dc:title="RDF/XML Syntax Specification (Revised)">
<ex:editor RDF:resource="rdf:#$X+Ujz3"/>
</RDF:Description>
Note that the previous example works fine if you swap the two <RDF:Description>.
Assignee | ||
Comment 1•16 years ago
|
||
I found bug 232623 which introduced the rdf:nodeID feature. I'm not familiar at all with Mozilla's code, yet the following lines of its patch look suspect to my eyes:
+ if (!*aResource) {
+ mNodeIDMap.Put(nodeID,*aResource);
+ return gRDFService->GetAnonymousResource(aResource);
It seems that we're associating "nodeID" with a null resource in "mNodeIDMap", then we create the anonymous resource. Which, I think, will make the parser create another resource the next time it sees the same "nodeID".
Comment 2•16 years ago
|
||
Comment on attachment 349648 [details] [diff] [review]
Proposed fix
Nice catch.
r-, though, we shouldn't put *aResource into mNodeIDMap on failure. Put in a
if (NS_FAILED(rv)) return rv;
and then no explicit return in the if clause?
Attachment #349648 -
Flags: review-
Updated•16 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Updated•16 years ago
|
Attachment #349648 -
Flags: review- → review?
Updated•16 years ago
|
Attachment #349648 -
Flags: review? → review-
Assignee | ||
Comment 3•16 years ago
|
||
Attachment #349648 -
Attachment is obsolete: true
Updated•16 years ago
|
Attachment #349649 -
Flags: superreview?(shaver)
Attachment #349649 -
Flags: review+
Comment 4•16 years ago
|
||
Comment on attachment 349649 [details] [diff] [review]
Same patch, but check rv before adding the resource to the map
r=me, this needs sr still. Trying shaver. Mike, I think this is small and low-risk enough to take in RDF-land.
Updated•16 years ago
|
Assignee: nobody → mininet
OS: Linux → All
Hardware: PC → All
Version: unspecified → Trunk
Attachment #349649 -
Flags: superreview?(shaver)
Attachment #349649 -
Flags: superreview+
Attachment #349649 -
Flags: approval1.9.1?
Comment on attachment 349649 [details] [diff] [review]
Same patch, but check rv before adding the resource to the map
sr=shaver, just for nostalgia's sake
Comment 6•16 years ago
|
||
Comment on attachment 349649 [details] [diff] [review]
Same patch, but check rv before adding the resource to the map
a191=beltzner
Attachment #349649 -
Flags: approval1.9.1? → approval1.9.1+
Comment 7•16 years ago
|
||
Landed on mozilla-central for baking, http://hg.mozilla.org/mozilla-central/rev/f4ca2f598902. Leaving open to remind me on 1.9.1
Whiteboard: [backing on mozilla-central]
Comment 8•16 years ago
|
||
Landed on 1.9.1, too, http://hg.mozilla.org/releases/mozilla-1.9.1/rev/0fcb3bd9bd58.
Thanks for the patch, Florian.
FIXED and fixed1.9.1.
Status: NEW → RESOLVED
Closed: 16 years ago
Keywords: fixed1.9.1
Resolution: --- → FIXED
Whiteboard: [backing on mozilla-central]
Target Milestone: --- → mozilla1.9.1b3
Updated•6 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•