-
-
Save kal/b21e3b4350c19994820f52d55cec9237 to your computer and use it in GitHub Desktop.
Strawman proposal for an interface for handling RDF streams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// An interface for processing a stream of RDF as a chain of nodes. | |
/// </summary> | |
public interface IChainedRdfHandler | |
{ | |
/// <summary> | |
/// Call to initialise the handler. | |
/// </summary> | |
/// <remarks>This could be omitted if we just delegate all initialisation to the constructor</remarks> | |
/// <param name="nsMap"></param> | |
void StartDocument(INamespaceMapper nsMap); | |
/// <summary> | |
/// Indicate the end of writing. No further method calls are allowed. | |
/// </summary> | |
void EndDocument(); | |
/// <summary> | |
/// Start writing a named graph. By default the initial context will be the unnamed graph. | |
/// </summary> | |
/// <param name="graphName"></param> | |
void StartGraph(IRefNode graphName); | |
/// <summary> | |
/// End writing a named graph and return the context to the unnamed graph. Can only be invoked if there are no open subjects. | |
/// </summary> | |
void EndGraph(); | |
/// <summary> | |
/// Push a new anonymous blank node onto the end of the chain. | |
/// </summary> | |
void StartSubject(); | |
/// <summary> | |
/// Push a new URI node onto the end of the chain | |
/// </summary> | |
/// <param name="subject"></param> | |
void StartSubject(IUriNode subject); | |
/// <summary> | |
/// Push a labelled blank node onto the end of the chain | |
/// </summary> | |
/// <param name="subject"></param> | |
void StartSubject(IBlankNode subject); | |
/// <summary> | |
/// Push a TripleNode onto the end of the chain | |
/// </summary> | |
/// <param name="subject"></param> | |
void StartSubject(ITripleNode subject); | |
/// <summary> | |
/// Pop the end of the chain if it is a subject (if the end of the chain is a predicate then this is an error) | |
/// </summary> | |
void EndSubject(); | |
/// <summary> | |
/// Push a predicate onto the end of the chain. If the last node in the chain is a predicate node when this method is called, an intermediate anonymous blank node should be pushed to the end of the chain first. | |
/// </summary> | |
/// <param name="predicate"></param> | |
void StartPredicate(IUriNode predicate); | |
/// <summary> | |
/// Pop the end of the chain if it is a predicate (if the end of the chain is a subject then this is an error) | |
/// </summary> | |
void EndPredicate(); | |
/// <summary> | |
/// Push the specified collection node to the end of the chain | |
/// </summary> | |
void StartCollection(IRefNode collectionNode); | |
/// <summary> | |
/// Push an anonymous collection node to the end of the chain | |
/// </summary> | |
void StartCollection(); | |
/// <summary> | |
/// Pop the end of the chain if it is a collection node, otherwise raise an error | |
/// </summary> | |
void EndCollection(); | |
/// <summary> | |
/// Push the specified collection member node to the end of the chain. | |
/// </summary> | |
void StartMember(IRefNode memberNode); | |
/// <summary> | |
/// Pop the specified collection member node from the end of the chain. | |
/// </summary> | |
void EndMember(); | |
/// <summary> | |
/// Push the specified container node to the end of the chain. | |
/// </summary> | |
/// <param name="containerType">The container type (bag, seq, alt)</param> | |
/// <param name="containerNode"></param> | |
void StartContainer(RdfContainerType containerType, IRefNode containerNode); | |
/// <summary> | |
/// Push an anonymous container node to the end of the chain. | |
/// </summary> | |
/// <param name="containerType"></param> | |
void StartContainer(RdfContainerType containerType); | |
/// <summary> | |
/// Pop the end of the chain if it is a container node, otherwise raise an error | |
/// </summary> | |
void EndContainer(); | |
/// <summary> | |
/// Emit a triple that has the most recently pushed subject node as its subject, the most recently pushed predicate node as its predicate and the specified value as its object. | |
/// </summary> | |
/// <remarks>The predicate MUST be the last item in the current chain, the subject MUST be the second to last item in the current chain.</remarks> | |
/// <param name="objectNode"></param> | |
void Object(INode objectNode); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment