2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 22:33:16 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-05-04 07:37:07 +04:00
|
|
|
*
|
2004-04-17 22:33:16 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-05-04 07:37:07 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-05-04 07:37:07 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 22:33:16 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
2004-10-22 22:33:55 +04:00
|
|
|
* Jan Varga <varga@ku.sk>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 22:33:16 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-17 22:33:16 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-17 22:33:16 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-05-04 07:37:07 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
1999-07-17 04:11:19 +04:00
|
|
|
#include "nsISupportsArray.idl"
|
1999-05-04 07:37:07 +04:00
|
|
|
#include "nsIRDFResource.idl"
|
|
|
|
#include "nsIRDFNode.idl"
|
2001-10-31 01:07:28 +03:00
|
|
|
#include "nsISimpleEnumerator.idl"
|
1999-05-04 07:37:07 +04:00
|
|
|
#include "nsIRDFObserver.idl"
|
1999-05-07 23:56:19 +04:00
|
|
|
|
|
|
|
%{C++
|
|
|
|
#include "nsISupportsArray.h"
|
|
|
|
%}
|
1999-05-04 07:37:07 +04:00
|
|
|
|
|
|
|
[scriptable, uuid(0F78DA58-8321-11d2-8EAC-00805F29F370)]
|
|
|
|
interface nsIRDFDataSource : nsISupports
|
|
|
|
{
|
1999-06-24 04:22:58 +04:00
|
|
|
/** The "URI" of the data source. This used by the RDF service's
|
|
|
|
* |GetDataSource()| method to cache datasources.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
readonly attribute string URI;
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/** Find an RDF resource that points to a given node over the
|
|
|
|
* specified arc & truth value
|
|
|
|
*
|
|
|
|
* @return NS_RDF_NO_VALUE if there is no source that leads
|
|
|
|
* to the target with the specified property.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
nsIRDFResource GetSource(in nsIRDFResource aProperty,
|
|
|
|
in nsIRDFNode aTarget,
|
|
|
|
in boolean aTruthValue);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Find all RDF resources that point to a given node over the
|
|
|
|
* specified arc & truth value
|
|
|
|
*
|
|
|
|
* @return NS_OK unless a catastrophic error occurs. If the
|
|
|
|
* method returns NS_OK, you may assume that nsISimpleEnumerator points
|
|
|
|
* to a valid (but possibly empty) cursor.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
nsISimpleEnumerator GetSources(in nsIRDFResource aProperty,
|
2000-08-09 10:20:13 +04:00
|
|
|
in nsIRDFNode aTarget,
|
|
|
|
in boolean aTruthValue);
|
1999-05-04 07:37:07 +04:00
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Find a child of that is related to the source by the given arc
|
|
|
|
* arc and truth value
|
|
|
|
*
|
2005-11-21 09:30:34 +03:00
|
|
|
* @return NS_RDF_NO_VALUE if there is no target accessible from the
|
1999-06-24 04:22:58 +04:00
|
|
|
* source via the specified property.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
nsIRDFNode GetTarget(in nsIRDFResource aSource,
|
|
|
|
in nsIRDFResource aProperty,
|
|
|
|
in boolean aTruthValue);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Find all children of that are related to the source by the given arc
|
|
|
|
* arc and truth value.
|
|
|
|
*
|
|
|
|
* @return NS_OK unless a catastrophic error occurs. If the
|
|
|
|
* method returns NS_OK, you may assume that nsISimpleEnumerator points
|
|
|
|
* to a valid (but possibly empty) cursor.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
nsISimpleEnumerator GetTargets(in nsIRDFResource aSource,
|
2000-08-09 10:20:13 +04:00
|
|
|
in nsIRDFResource aProperty,
|
|
|
|
in boolean aTruthValue);
|
1999-05-04 07:37:07 +04:00
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Add an assertion to the graph.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
void Assert(in nsIRDFResource aSource,
|
|
|
|
in nsIRDFResource aProperty,
|
|
|
|
in nsIRDFNode aTarget,
|
|
|
|
in boolean aTruthValue);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Remove an assertion from the graph.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
void Unassert(in nsIRDFResource aSource,
|
|
|
|
in nsIRDFResource aProperty,
|
|
|
|
in nsIRDFNode aTarget);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Change an assertion from
|
|
|
|
*
|
|
|
|
* [aSource]--[aProperty]-->[aOldTarget]
|
|
|
|
*
|
|
|
|
* to
|
|
|
|
*
|
|
|
|
* [aSource]--[aProperty]-->[aNewTarget]
|
|
|
|
*/
|
|
|
|
void Change(in nsIRDFResource aSource,
|
|
|
|
in nsIRDFResource aProperty,
|
|
|
|
in nsIRDFNode aOldTarget,
|
|
|
|
in nsIRDFNode aNewTarget);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 'Move' an assertion from
|
|
|
|
*
|
|
|
|
* [aOldSource]--[aProperty]-->[aTarget]
|
|
|
|
*
|
|
|
|
* to
|
|
|
|
*
|
|
|
|
* [aNewSource]--[aProperty]-->[aTarget]
|
|
|
|
*/
|
|
|
|
void Move(in nsIRDFResource aOldSource,
|
|
|
|
in nsIRDFResource aNewSource,
|
|
|
|
in nsIRDFResource aProperty,
|
|
|
|
in nsIRDFNode aTarget);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Query whether an assertion exists in this graph.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
boolean HasAssertion(in nsIRDFResource aSource,
|
|
|
|
in nsIRDFResource aProperty,
|
|
|
|
in nsIRDFNode aTarget,
|
|
|
|
in boolean aTruthValue);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Add an observer to this data source. If the datasource
|
|
|
|
* supports observers, the datasource source should hold a strong
|
|
|
|
* reference to the observer.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
void AddObserver(in nsIRDFObserver aObserver);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Remove an observer from this data source.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
void RemoveObserver(in nsIRDFObserver aObserver);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Get a cursor to iterate over all the arcs that point into a node.
|
|
|
|
*
|
|
|
|
* @return NS_OK unless a catastrophic error occurs. If the method
|
|
|
|
* returns NS_OK, you may assume that labels points to a valid (but
|
|
|
|
* possible empty) nsISimpleEnumerator object.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
nsISimpleEnumerator ArcLabelsIn(in nsIRDFNode aNode);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Get a cursor to iterate over all the arcs that originate in
|
|
|
|
* a resource.
|
|
|
|
*
|
|
|
|
* @return NS_OK unless a catastrophic error occurs. If the method
|
|
|
|
* returns NS_OK, you may assume that labels points to a valid (but
|
|
|
|
* possible empty) nsISimpleEnumerator object.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
nsISimpleEnumerator ArcLabelsOut(in nsIRDFResource aSource);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Retrieve all of the resources that the data source currently
|
|
|
|
* refers to.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
nsISimpleEnumerator GetAllResources();
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Returns whether a given command is enabled for a set of sources.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
boolean IsCommandEnabled(in nsISupportsArray aSources,
|
|
|
|
in nsIRDFResource aCommand,
|
|
|
|
in nsISupportsArray aArguments);
|
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Perform the specified command on set of sources.
|
|
|
|
*/
|
1999-05-04 07:37:07 +04:00
|
|
|
void DoCommand(in nsISupportsArray aSources,
|
|
|
|
in nsIRDFResource aCommand,
|
|
|
|
in nsISupportsArray aArguments);
|
1999-06-26 05:09:02 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the set of all commands defined for a given source.
|
|
|
|
*/
|
|
|
|
nsISimpleEnumerator GetAllCmds(in nsIRDFResource aSource);
|
|
|
|
|
2000-07-19 07:58:25 +04:00
|
|
|
/**
|
|
|
|
* Returns true if the specified node is pointed to by the specified arc.
|
|
|
|
* Equivalent to enumerating ArcLabelsIn and comparing for the specified arc.
|
|
|
|
*/
|
|
|
|
boolean hasArcIn(in nsIRDFNode aNode, in nsIRDFResource aArc);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the specified node has the specified outward arc.
|
|
|
|
* Equivalent to enumerating ArcLabelsOut and comparing for the specified arc.
|
|
|
|
*/
|
|
|
|
boolean hasArcOut(in nsIRDFResource aSource, in nsIRDFResource aArc);
|
1999-05-04 07:37:07 +04:00
|
|
|
|
2003-05-23 16:03:40 +04:00
|
|
|
/**
|
|
|
|
* Notify observers that the datasource is about to send several
|
|
|
|
* notifications at once.
|
|
|
|
* This must be followed by calling endUpdateBatch(), otherwise
|
|
|
|
* viewers will get out of sync.
|
|
|
|
*/
|
|
|
|
void beginUpdateBatch();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notify observers that the datasource has completed issuing
|
|
|
|
* a notification group.
|
|
|
|
*/
|
|
|
|
void endUpdateBatch();
|
|
|
|
};
|