2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-05-04 07:37:07 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#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
|
|
|
|
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.
|
|
|
|
*/
|
2017-10-21 14:28:36 +03:00
|
|
|
readonly attribute ACString URI;
|
1999-05-04 07:37:07 +04:00
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/** Find an RDF resource that points to a given node over the
|
|
|
|
* specified arc & truth value
|
|
|
|
*
|
2013-05-16 16:26:55 +04:00
|
|
|
* @throws NS_RDF_NO_VALUE if there is no source that leads
|
1999-06-24 04:22:58 +04:00
|
|
|
* 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
|
|
|
|
*/
|
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
|
|
|
|
*
|
2013-05-16 16:26:55 +04:00
|
|
|
* @throws 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.
|
|
|
|
*/
|
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.
|
|
|
|
*/
|
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.
|
|
|
|
*/
|
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.
|
|
|
|
*/
|
2016-11-04 21:03:26 +03:00
|
|
|
boolean IsCommandEnabled(in nsISupports aSources,
|
1999-05-04 07:37:07 +04:00
|
|
|
in nsIRDFResource aCommand,
|
2016-11-04 21:03:26 +03:00
|
|
|
in nsISupports aArguments);
|
1999-05-04 07:37:07 +04:00
|
|
|
|
1999-06-24 04:22:58 +04:00
|
|
|
/**
|
|
|
|
* Perform the specified command on set of sources.
|
|
|
|
*/
|
2016-11-04 21:03:26 +03:00
|
|
|
void DoCommand(in nsISupports aSources,
|
1999-05-04 07:37:07 +04:00
|
|
|
in nsIRDFResource aCommand,
|
2016-11-04 21:03:26 +03:00
|
|
|
in nsISupports 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();
|
|
|
|
};
|