miss an nsIRDFClipboardDataSource

RESOLVED WONTFIX

Status

--
enhancement
RESOLVED WONTFIX
15 years ago
4 months ago

People

(Reporter: leo_salvatore77, Assigned: mozilla)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
User-Agent:       
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113

I miss one thing, that may be important in my opinion.
an RDF clipboard. That is, a component to provide some functionallity with
RDF Datasources to copy and paste resources from one datsource to another

Reproducible: Always
Steps to Reproduce:
1.
2.
3.



Expected Results:  
a component to provide some functionallity with
RDF Datasources to copy and paste resources from one datsource to another

Here it is an nsIRDFDataSource.idl propposal

/**
 * This idl is intended as a primer of a RDFClipboard
 * utility to make easier the transfer of some amounts of
 * data between datasources. and Store temporally some 
 * RDF information. 
 * Related ideas:
 * nsIPipelineDataSource to implement a pipeline between datasources
 * nsIRDFPrologDataSource to perform some prolog rules to the 
 * assertions of the Datasource;
 */


#include "nsIRDFDataSource.idl"


%{C++
#include "nsISupportsArray.h"
%}



[scriptable, uuid(some-id)]
interface nsIRDFClipboard : nsISupports
{
	 /** true if the clipboard datasource is empty 
		*/
	 readonly attribute boolean empty;

	 /** Get the specified Resource from the given 
	   * aDatasource and copy it in an RDF datasource
		 * that represents the clipboard, the Resource
		 * copy is done from the specified resource
		 * including every arcout of it. 
		 * When recurse  attribute is set to true, if the arcouts 
		 * are pointing to a nsIRDFResource, the method
		 * must recurse until an arcout were a nsIRDFLiteral
		 * or the current nsIRDFResource does not have 
		 * more arcout. In case the nsIRDFResource and the 
		 * arcout are a cycle, must stop recurse.
		 * If recurse attribute is set to false, the method 
		 * must copy only the aResource as subject, and all
		 * the arcouts with its respective objects, but not
		 * recurse into its objects.
		*/
	 void CopyResource(in nsIRDFResource aSource,
                     in nsIRDFDataSource aDataSource,
                     in boolean     recurse);,


	 /**
		* Copy all the resources from given aDataSource into 
		* the clipboard
		*/
	 void Copy(in nsIRDFDataSource aDataSource);

	 /**
		*
		* The same idea of CopyResource. The difference is
		* the output is the given aDataSource and the 
		* input is the RDFClipboard.
		*/
	 void PasteResource(in nsIRDFResource aSource,
                      in nsIRDFDataSource aDataSource);

	 /**
	  * Paste all the content of the clipboard to the 
		* given aDataSource
		*/
	 void Paste(in nsIRDFDataSource aDataSource);
	 /**
	  * clean the content of the clipboard
		*/
	 void flush();
};

Comment 1

15 years ago
Confirming as an RFE; I asked Leo to file this on npm.rdf.

The idea of providing some sort of tool for copying whole or partial datasources
would save some implementors work.  The odd thing about this proposal is that
it's set up as a datasource.  Is there a reason to do it this way, rather than
just as a set of utility routines that copy between two arbitrary datasources?

Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 2

15 years ago
As Neil Deakin said in 
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&threadm=bva2u0%24atc2%40ripley.netscape.com&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dnetscape.public.mozilla.rdf
there is no such thing as a "resource in a datasource".
But it may be a good idea to create a utility class to copy arcs from one 
datasource to another. I don't think that we should have a "clipboard" class
for this, though. One could create a clipboard by creating a in-mem-ds and
just copy stuff in there.

I'd rather do something like

  copyArcsOut(in nsIRDFResource aResource,
              in nsIRDFDataSource aSourceDS,
              in nsIRDFDataSource aTargetDS,
              in bool aRecurse);
  copyDataSource(in nsIRDFDataSource aSourceDS,
                 in nsIRDFDataSource aTargetDS);
on some nsIRDFCopyUtils interface.
(Reporter)

Comment 3

15 years ago
Ok. I agree with all of you.
Maybe a nsIRDFDataSourceTools is a better idea. 

On the other hand I'd like to comment some stuffs about 
the RDF API to work with RDFNodes.

As far as I know, the very only way to know if an nsIRDFNode is
a nsIRDFResource or a nsIRDFLiteral is making a QueryInterface(nsIRDFResource) 
inside a try statement, if an Exceptions is raised it means the nsIRDFNode is
a nsIRDFLiteral. Is there other way to do it?

In other sort of things, what about http://www.mozilla.org/rdf/doc/inference.html
It could a ver interesting feature. 

Leo. 
QA Contact: rdf

Updated

9 years ago
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → WONTFIX

Updated

4 months ago
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.