Added nsIRDFContainer and nsIRDFContainerUtils.

This commit is contained in:
waterson%netscape.com 1999-04-26 18:45:14 +00:00
Родитель 34a0dcc940
Коммит c1acd45694
1 изменённых файлов: 0 добавлений и 327 удалений

Просмотреть файл

@ -1,327 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/*
This file contains _all_ of the interface definitions, lumped into
one big happy file. It's done this way to circumvent problems with
forward declarations in the current version of `xpidl'.
*/
#include "nsIEnumerator.idl"
#include "nsISimpleEnumerator.idl"
#include "nsISupports.idl"
#include "nsISupportsArray.idl"
%{C++
#include "nscore.h" // for PRUnichar
%}
// An nsIRDFNode object is an abstract placeholder for a node in the
// RDF data model. Its concreted implementations (e.g., nsIRDFResource
// or nsIRDFLiteral) are the actual objects that populate the graph.
[scriptable, uuid(0F78DA50-8321-11d2-8EAC-00805F29F370)]
interface nsIRDFNode : nsISupports {
// Determine if two nodes are identical
boolean EqualsNode(in nsIRDFNode aNode);
};
// An nsIRDFResource is an object that has unique identity in the
// RDF data model. The object's identity is determined by its URI.
[scriptable, uuid(E0C493D1-9542-11d2-8EB8-00805F29F370)]
interface nsIRDFResource : nsIRDFNode {
// The single-byte string value of the resource
readonly attribute string Value;
// This method is called by the nsIRDFService after constructing
// a resource object to initialize it's URI. You would not normally
// call this method directly
void Init(in string uri);
// Determine if two resources are identical.
boolean EqualsResource(in nsIRDFResource aResource);
// Determine if the resource has the given URI.
boolean EqualsString(in string aURI);
};
// A literal node in the graph, whose value is a string.
[scriptable, uuid(E0C493D2-9542-11d2-8EB8-00805F29F370)]
interface nsIRDFLiteral : nsIRDFNode {
// The Unicode string value of the literal.
readonly attribute wstring Value;
// Determine if two literals are identical.
boolean EqualsLiteral(in nsIRDFLiteral aLiteral);
};
// A literal node in the graph, whose value is a date
[scriptable, uuid(E13A24E1-C77A-11d2-80BE-006097B76B8E)]
interface nsIRDFDate : nsIRDFNode {
// The date value of the literal
readonly attribute long long Value;
// Determine if the date is equal to another
//
// XXX Is this really necessary?
boolean EqualsDate(in nsIRDFDate aDate);
};
// A literal node in the graph, whose value is an integer
[scriptable, uuid(E13A24E3-C77A-11d2-80BE-006097B76B8E)]
interface nsIRDFInt : nsIRDFNode {
// The integer value of the literal
readonly attribute long Value;
// Determine if the integer is equal to another
//
// XXX Is this really necessary?
boolean EqualsInt(in nsIRDFInt aInt);
};
interface nsIRDFDataSource;
// An nsIRDFObserver object is an observer that will be notified
// when assertions are made or removed from a datasource
[scriptable, uuid(3CC75360-484A-11D2-BC16-00805F912FE7)]
interface nsIRDFObserver : nsISupports {
// This method is called whenever a new assertion is made
// in the data source
void OnAssert(in nsIRDFResource aSource,
in nsIRDFResource aLabel,
in nsIRDFNode aTarget);
// This method is called whenever an assertion is removed
// from the data source
void OnUnassert(in nsIRDFResource aSource,
in nsIRDFResource aLabel,
in nsIRDFNode aTarget);
};
[scriptable, uuid(0F78DA58-8321-11d2-8EAC-00805F29F370)]
interface nsIRDFDataSource : nsISupports {
// Specify the URI for the data source: this is the prefix
// that will be used to register the data source in the
// data source registry.
void Init(in string uri);
// The URI of the data source.
readonly attribute string URI;
// 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.
nsIRDFResource GetSource(in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue);
// 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.
nsISimpleEnumerator GetSources(in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue);
// Find a child of that is related to the source by the given arc
// arc and truth value
//
// @return NS_RDF_NO_VALUE if there is no target accessable from the
// source via the specified property.
nsIRDFNode GetTarget(in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in boolean aTruthValue);
// 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.
nsISimpleEnumerator GetTargets(in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in boolean aTruthValue);
// Add an assertion to the graph.
void Assert(in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue);
// Remove an assertion from the graph.
void Unassert(in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in nsIRDFNode aTarget);
// Query whether an assertion exists in this graph.
boolean HasAssertion(in nsIRDFResource aSource,
in nsIRDFResource aProperty,
in nsIRDFNode aTarget,
in boolean aTruthValue);
// Add an observer to this data source.
void AddObserver(in nsIRDFObserver aObserver);
// Remove an observer from this data source
void RemoveObserver(in nsIRDFObserver aObserver);
// 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.
nsISimpleEnumerator ArcLabelsIn(in nsIRDFNode aNode);
// 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.
nsISimpleEnumerator ArcLabelsOut(in nsIRDFResource aSource);
// Retrieve all of the resources that the data source currently
// refers to.
nsISimpleEnumerator GetAllResources();
// Request that a data source write it's contents out to
// permanent storage if applicable.
void Flush();
// Returns the set of all commands defined for a given source.
nsIEnumerator GetAllCommands(in nsIRDFResource aSource);
// Returns whether a given command is enabled for a set of sources.
boolean IsCommandEnabled(in nsISupportsArray aSources,
in nsIRDFResource aCommand,
in nsISupportsArray aArguments);
// Perform the specified command on set of sources.
void DoCommand(in nsISupportsArray aSources,
in nsIRDFResource aCommand,
in nsISupportsArray aArguments);
};
// An nsIRDFCompositeDataSource composes individual data sources, providing
// the illusion of a single, coherent RDF graph.
[scriptable, uuid(96343820-307C-11D2-BC15-00805F912FE7)]
interface nsIRDFCompositeDataSource : nsIRDFDataSource {
// Add a datasource the the database.
void AddDataSource(in nsIRDFDataSource aDataSource);
// Remove a datasource from the database
void RemoveDataSource(in nsIRDFDataSource aDataSource);
};
// The RDF service interface. This is a singleton object, and should be
// obtained from the <tt>nsServiceManager</tt>.
[scriptable, uuid(BFD05261-834C-11d2-8EAC-00805F29F370)]
interface nsIRDFService : nsISupports {
// Construct an RDF resource from a single-byte URI. <tt>nsIRDFSerivce</tt>
// caches resources that are in-use, so multiple calls to <tt>GetResource()</tt>
// for the same <tt>uri</tt> will return identical pointers. FindResource
// is used to find out whether there already exists a resource corresponding to that url.
nsIRDFResource GetResource(in string aURI);
// Construct an RDF resource from a Unicode URI. This is provided
// as a convenience method, allowing automatic, in-line C++
// conversion from <tt>nsString</tt> objects. The <tt>uri</tt> will
// be converted to a single-byte representation internally.
nsIRDFResource GetUnicodeResource(in wstring aURI);
// Construct an RDF literal from a Unicode string.
nsIRDFLiteral GetLiteral(in wstring aValue);
// Construct an RDF literal from a PRTime.
nsIRDFDate GetDateLiteral(in long long aValue);
// Construct an RDF literal from an int.
nsIRDFInt GetIntLiteral(in long aValue);
// Registers a resource with the RDF system, making it unique w.r.t.
// GetResource.
//
// An implementation of nsIRDFResource should call this in its
// Init() method if it wishes the resource to be globally unique
// (which is usually the case).
//
// NOTE that the resource will <i>not</i> be ref-counted by the
// RDF service: the assumption is that the resource implementation
// will call nsIRDFService::UnregisterResource() when the last
// reference to the resource is released.
//
// NOTE that the nsIRDFService implementation may choose to
// maintain a reference to the resource's URI; therefore, the
// resource implementation should ensure that the resource's URI
// (accessable via nsIRDFResource::GetValue(const char* *aURI)) is
// valid before calling RegisterResource(). Furthermore, the
// resource implementation should ensure that this pointer
// <i>remains</i> valid for the lifetime of the resource. (The
// implementation of the resource cache in nsIRDFService uses the
// URI maintained "internally" in the resource as a key into the
// cache rather than copying the resource URI itself.)
void RegisterResource(in nsIRDFResource aResource, in boolean aReplace);
// Called to notify the resource manager that a resource is no
// longer in use. This method should only be called from the
// destructor of a "custom" resource implementation to notify the
// RDF service that the last reference to the resource has been
// released, so the resource is no longer valid.
//
// NOTE. As mentioned in nsIRDFResourceFactory::CreateResource(),
// the RDF service will use the result of
// nsIRDFResource::GetValue() as a key into its cache. For this
// reason, you must always un-cache the resource <b>before</b>
// releasing the storage for the <tt>const char*</tt> URI.
void UnregisterResource(in nsIRDFResource aResource);
// Register a <i>named data source</i>. The RDF service will call
// <tt>nsIRDFDataSource::GetURI()</tt> to determine the URI under
// which to register the data source.
//
// Note that the data source will <i>not</i> be refcounted by the
// RDF service! The assumption is that an RDF data source
// registers with the service once it is initialized (via
// <tt>nsIRDFDataSource::Init()</tt>), and unregisters when the
// last reference to the data source is released.
void RegisterDataSource(in nsIRDFDataSource aDataSource,
in boolean aReplace);
// Unregister a <i>named data source</i>. The RDF service will call
// <tt>nsIRDFDataSource::GetURI()</tt> to determine the URI under which the
// data source was registered.
void UnregisterDataSource(in nsIRDFDataSource aDataSource);
// Get the <i>named data source</i> corresponding to the URI. If a data
// source has been registered via <tt>RegisterDataSource()</tt>, that
// data source will be returned.
//
// If no data source is currently
// registered for the specified URI, and a data source <i>constructor</i>
// function has been registered via <tt>RegisterDatasourceConstructor()</tt>,
// the RDF service will call the constructor to attempt to construct a
// new data source. If construction is successful, the data source will
// be initialized via <tt>nsIRDFDataSource::Init()</tt>.
nsIRDFDataSource GetDataSource(in string aURI);
};