Closed Bug 252734 Opened 21 years ago Closed 11 months ago

RFE create methods in container utils to destruct containers

Categories

(Core Graveyard :: RDF, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: mbaumann, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.8 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.1) Gecko/20040707 I am working with the Components.interfaces.nsIRDFContainer with the methode RemoveElement(child,true) i removing all child rom the container. The child's are deleted sucssfully, but sometimes the Container itself is not deleted. database.refresh or flush have no effects. Reproducible: Always Steps to Reproduce: function deleteMapping(c_datasource,c_id){ debugger; try{ var container =null; var datasource=c_datasource; var delchild = new Array(); var count=0; var id =c_id; if ( id instanceof Components.interfaces.nsIRDFResource){ container = id; }else{ container =RDF.GetResource(id); } if (RDFCUtils.IsContainer(datasource,container)){ var RDFcontainer = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer); try { RDFcontainer.Init(datasource, container); } catch (ex){} var childs = RDFcontainer.GetElements(); while (childs.hasMoreElements()){ var child = childs.getNext(); if (child instanceof Components.interfaces.nsIRDFResource){ count++; delchild[count]=child; if (RDFCUtils.IsContainer(datasource,child)){ deleteMapping(datasource,child); } RDFcontainer.RemoveElement(child,true); } } } var isempty = RDFCUtils.IsEmpty(datasource,container); container = null; dbgmsg("Container empty :"+isempty); // is prnting tue but the SEQ are not deleted datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush(); }catch(e){ errmsg("Error in deleteMapping: "+e.message); } } Actual Results: <RDF:Seq RDF:about="rdf:#$AP1nt"> </RDF:Seq> Expected Results: no <RDF:Seq> tag in the rdf file
This is invalid. An empty container is still a container. If you want to remove its containerness, you need to Unassert the rdf:type of the container.
Neil, feel free to mark obvious bugs INVALID as you go.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
(In reply to comment #1) > This is invalid. An empty container is still a container. If you want to remove > its containerness, you need to Unassert the rdf:type of the container. > But I understand wath you mean with rdf:type. Please give me an example how i can delete this: <RDF:Seq RDF:about="rdf:#$AP1nt"> </RDF:Seq> from the rdf file. And for me is it a Bug, because sometimes the "<RDF:Seq RDF:about="rdf:#$AP1nt"> </RDF:Seq>" entry are deleted if no reference and no LI entry available. I try to diskribe this again. i have this rdf: ... <RDF:Seq RDF:about="rdf:#$AhgxG1"> <RDF:li RDF:resource="rdf:#$BhgxG1"/> </RDF:Seq> <RDF:Description RDF:about="rdf:#$AhgxG1" EBMTVC:name="func" EBMTVC:mapimage="func_node" /> ... I delete first all attribute form <RDF:Description RDF:about="rdf:#$AhgxG1" also UNassert (..,name,func) and Unassert(..,mapimage,func_node) and so on. And now i Remove the li Element with RemoveElement with the Container Object. Ok now my RDF look like this: ... <RDF:Seq RDF:about="rdf:#$AhgxG1"> </RDF:Seq> ... How can I delete this ? And sometimes it is deleted !! I using every time the code discribed above.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
morphing bug into what it really is, that is, add a convenience method to nsIRDFContainerUtils to destruct a container completely. Wrapping this inside container utils has the advantage of us being able to fix instance_of vs type behind the curtains for folks that do this by ad-hoc unasserting internal arcs to get rid of containers.
Severity: major → enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Hardware: PC → All
Summary: <RDF:Seq> Tag will not been delted if no list entry available → RFE create methods in container utils to destruct containers
Whiteboard: [good first bug]
Given how we're excising RDF from our code, this isn't really good first bug material any longer.
Whiteboard: [good first bug]
Product: Core → Core Graveyard
Status: NEW → RESOLVED
Closed: 21 years ago11 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.