Closed Bug 100670 Opened 23 years ago Closed 23 years ago

unexpected attributes on a property element confuse RDF content sink

Categories

(Core :: XUL, defect, P3)

defect

Tracking

()

RESOLVED INVALID
mozilla1.0

People

(Reporter: mozilla, Assigned: waterson)

Details

Attachments

(1 file)

Here is the XUL and RDF source to reproduce.

1. Copy the XUL source below to chrome\bugz\content\bugz3.xul 
2. Copy the RDF source below to chrome\bugz\content\bugz3.rdf
3. Run mozilla: mozilla -chrome chrome://bugz/content/bugz3.xul
4. Press the Populate button
5. Click on the "Algebra" node and see the bogus child label (e.g., 
rdf:#$??????)
6. Look at the RDF entry for Algebra and notice it is empty: <substrand-name 
empty="yes"/>


XUL SOURCE

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="treetest" title="XUL Tree Test"
	xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"        
	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

<script>
function treepop()
	{
	var widget=document.getElementById("tree");

	var RDF = '@mozilla.org/rdf/rdf-service;1'
	RDF = Components.classes[RDF].getService();
	RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
	var datasource = RDF.GetDataSource("chrome://bugz/content/bugz3.rdf");


	widget.database.AddDataSource(datasource);
	widget.setAttribute("ref", "urn:raven:sql:_1_:data");
	widget.builder.rebuild();
	}

</script>

	<hbox flex="0">
		<vbox flex="0">
			<button label="populate" onclick="treepop();"/>
			<tree id="tree" style="max-height:200px;" 
datasources="rdf:null">
				<template>
					<rule>
						<treechildren flex="1">
							<treeitem uri="rdf:*">
								<treerow>
								
	<treecell class="treecell-indent" label="rdf:strand-name" flex="0"/>
								
	<treecell label="rdf:substrand-name" flex="1"/>
								</treerow>
							</treeitem>
						</treechildren>
					</rule>
				</template>
			</tree>

		</vbox>
	</hbox>
</window>





RDF SOURCE 

<?xml version="1.0"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
        <RDF:Seq about="urn:raven:sql:_1_:data">
                <RDF:li>
                        <RDF:Seq about="urn:raven:sql:_1_:list00001">
                                <RDF:li 
resource="urn:raven:sql:_1_:list00001:record00001"/>
                        </RDF:Seq>
                </RDF:li>
                <RDF:li>
                        <RDF:Seq about="urn:raven:sql:_1_:list00002">
						<!--
                                <RDF:li 
resource="urn:raven:sql:_1_:list00002:record00001"/>
						-->
                        </RDF:Seq>
                </RDF:li>
                <RDF:li>
                        <RDF:Seq about="urn:raven:sql:_1_:list00003">
                                <RDF:li 
resource="urn:raven:sql:_1_:list00003:record00001"/>
                        </RDF:Seq>
                </RDF:li>
        </RDF:Seq>
        <RDF:Description about="urn:raven:sql:_1_:list00001">
                <strand-name>None</strand-name>
        </RDF:Description>
        <RDF:Description about="urn:raven:sql:_1_:list00001:record00001">
                <substrand-name>dog</substrand-name>
        </RDF:Description>
        <RDF:Description about="urn:raven:sql:_1_:list00002">
                <strand-name>Numeration and Number Theory</strand-name>
        </RDF:Description>
		<!--
        <RDF:Description about="urn:raven:sql:_1_:list00002:record00001">
                <substrand-name empty="yes"></substrand-name>
        </RDF:Description>
		-->
        <RDF:Description about="urn:raven:sql:_1_:list00003">
                <strand-name>Algebra</strand-name>
        </RDF:Description>
        <RDF:Description about="urn:raven:sql:_1_:list00003:record00001">
                <substrand-name empty="yes"/>
        </RDF:Description>
</RDF:RDF>

Greg
--> waterson
Assignee: hyatt → waterson
This is not a bug. You're <template> isn't right. Please refer to
http://www.mozilla.org/docs/xul/xulnotes/template-primer.xul, which should help
you get the syntax right. You can probably also get some help on n.p.m.rdf.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → INVALID
Ok, I looked more carefully at your test case. Ignore my ranting about the
template primer! It looks like you're actually emitting questionable RDF/XML.
According to [6.12] of

  <http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/>

(the rule for |propertyElt|), you probably ought not be emitting the
``empty="yes"'' attribute here:

  <RDF:Description about="urn:raven:sql:_1_:list00003:record00001">
    <substrand-name empty="yes"/>
  </RDF:Description>

Removing this actually produces what you probably expected as output.


I'm going to go ahead and re-open the bug under the theory that we ought to be
liberal towards the input that we accept, but you can ``work around'' this
problem right away by cleaning up your output.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P3
Summary: Empty rdf nodes cause tree node to contain a bogus label → unexpected attributes on a property element confuse RDF content sink
Target Milestone: --- → mozilla1.0
OS: Windows 2000 → All
Hardware: PC → All
I was staring at the last clause of rule 6.12:
   propertyElt ::= '<' propName idRefAttr? bagIdAttr? propAttr* '>'

trying to remember what this meant.  as usual, my ancient nemesis "Basic
Abbreviated Syntax" was messing with my head.  From M&S 2.2.2:

"The second RDF abbreviation form works on nested Description elements. This
abbreviation form can be employed for specific statements when the object of the
statement is another resource and the values of any properties given in-line for
this second resource are strings. In this case... the properties of the resource
in the nested Description may be written as XML attributes of the propertyElt
element in which that Description was contained."

Running rdfcat on this sample shows that we're generating an anonymous node and
two triples:
 (foo, substrand-name, #anon)
 (#anon, empty, "yes")

And after re-reading the abbreviated syntax stuff this seems like a reasonable
thing to be doing -- this form was designed to be used with things like
rdf:resource="...", but since both |idRefAttr| and |bagIdAttr| are optional....  
isn't our interpretation technically correct?  

The bogus child label originally reported is presumably the anonymous resource
ID (which, for reasons I've never entirely understood, mozilla prefixes with
'rdf:').


Ah, good. Thanks for setting me straight. So I guess I'll change my mind _again_
and mark this bug as INVALID, since it seems like (more or less) the right thing
is happening. :-)
Status: ASSIGNED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → INVALID
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: