Show / Hide Table of Contents

Class GraphExtensions

Provides useful Extension Methods for working with Graphs.
Inheritance
System.Object
GraphExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: VDS.RDF
Assembly: dotNetRDF.dll
Syntax
public static class GraphExtensions

Methods

| Improve this Doc View Source

ExecuteQuery(IGraph, String)

Executes a SPARQL Query on a Graph.
Declaration
public static object ExecuteQuery(this IGraph g, string sparqlQuery)
Parameters
Type Name Description
IGraph g Graph to query.
System.String sparqlQuery SPARQL Query.
Returns
Type Description
System.Object
| Improve this Doc View Source

ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, String)

Executes a SPARQL Query on a Graph handling the results using the handlers provided.
Declaration
public static void ExecuteQuery(this IGraph g, IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, string sparqlQuery)
Parameters
Type Name Description
IGraph g Graph to query.
IRdfHandler rdfHandler RDF Handler.
ISparqlResultsHandler resultsHandler SPARQL Results Handler.
System.String sparqlQuery SPARQL Query.
| Improve this Doc View Source

ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlParameterizedString)

Executes a SPARQL Query on a Graph handling the results using the handlers provided.
Declaration
public static void ExecuteQuery(this IGraph g, IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, SparqlParameterizedString sparqlQuery)
Parameters
Type Name Description
IGraph g Graph to query.
IRdfHandler rdfHandler RDF Handler.
ISparqlResultsHandler resultsHandler SPARQL Results Handler.
SparqlParameterizedString sparqlQuery SPARQL Query.
| Improve this Doc View Source

ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlQuery)

Executes a SPARQL Query on a Graph handling the results using the handlers provided.
Declaration
public static void ExecuteQuery(this IGraph g, IRdfHandler rdfHandler, ISparqlResultsHandler resultsHandler, SparqlQuery query)
Parameters
Type Name Description
IGraph g Graph to query.
IRdfHandler rdfHandler RDF Handler.
ISparqlResultsHandler resultsHandler SPARQL Results Handler.
SparqlQuery query SPARQL Query.
| Improve this Doc View Source

ExecuteQuery(IGraph, SparqlParameterizedString)

Executes a SPARQL Query on a Graph.
Declaration
public static object ExecuteQuery(this IGraph g, SparqlParameterizedString sparqlQuery)
Parameters
Type Name Description
IGraph g Graph to query.
SparqlParameterizedString sparqlQuery SPARQL Query.
Returns
Type Description
System.Object
| Improve this Doc View Source

ExecuteQuery(IGraph, SparqlQuery)

Executes a SPARQL Query on a Graph.
Declaration
public static object ExecuteQuery(this IGraph g, SparqlQuery query)
Parameters
Type Name Description
IGraph g Graph to query.
SparqlQuery query SPARQL Query.
Returns
Type Description
System.Object
| Improve this Doc View Source

LoadFromEmbeddedResource(IGraph, String)

Loads RDF data from an Embedded Resource into a Graph.
Declaration
public static void LoadFromEmbeddedResource(this IGraph g, string resource)
Parameters
Type Name Description
IGraph g Graph to load into.
System.String resource Assembly qualified name of the resource to load from.
Remarks
This is just a shortcut to using the static Load() methods from the EmbeddedResourceLoader class located in the VDS.RDF.Parsing namespace.
| Improve this Doc View Source

LoadFromEmbeddedResource(IGraph, String, IRdfReader)

Loads RDF data from an Embedded Resource into a Graph.
Declaration
public static void LoadFromEmbeddedResource(this IGraph g, string resource, IRdfReader parser)
Parameters
Type Name Description
IGraph g Graph to load into.
System.String resource Assembly qualified name of the resource to load from.
IRdfReader parser Parser to use.
Remarks
This is just a shortcut to using the static Load() methods from the EmbeddedResourceLoader class located in the VDS.RDF.Parsing namespace.
| Improve this Doc View Source

LoadFromFile(IGraph, String)

Loads RDF data from a file into a Graph.
Declaration
public static void LoadFromFile(this IGraph g, string file)
Parameters
Type Name Description
IGraph g Graph to load into.
System.String file File to load from.
Remarks

This is just a shortcut to using the static Load() methods from the FileLoader class located in the VDS.RDF.Parsing namespace.

Note: FileLoader will assign the Graph a file URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

If a File URI is assigned it will always be an absolute URI for the file.

| Improve this Doc View Source

LoadFromFile(IGraph, String, IRdfReader)

Loads RDF data from a file into a Graph.
Declaration
public static void LoadFromFile(this IGraph g, string file, IRdfReader parser)
Parameters
Type Name Description
IGraph g Graph to load into.
System.String file File to load from.
IRdfReader parser Parser to use.
Remarks

This is just a shortcut to using the static Load() methods from the FileLoader class located in the VDS.RDF.Parsing namespace.

Note: FileLoader will assign the Graph a file URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

If a File URI is assigned it will always be an absolute URI for the file.

| Improve this Doc View Source

LoadFromString(IGraph, String)

Loads RDF data from a String into a Graph.
Declaration
public static void LoadFromString(this IGraph g, string data)
Parameters
Type Name Description
IGraph g Graph to load into.
System.String data Data to load.
Remarks
This is just a shortcut to using the static Parse() methods from the StringParser class located in the VDS.RDF.Parsing namespace.
| Improve this Doc View Source

LoadFromString(IGraph, String, IRdfReader)

Loads RDF data from a String into a Graph.
Declaration
public static void LoadFromString(this IGraph g, string data, IRdfReader parser)
Parameters
Type Name Description
IGraph g Graph to load into.
System.String data Data to load.
IRdfReader parser Parser to use.
Remarks
This is just a shortcut to using the static Parse() methods from the StringParser class located in the VDS.RDF.Parsing namespace.
| Improve this Doc View Source

LoadFromUri(IGraph, Uri)

Loads RDF data from a URI into a Graph.
Declaration
public static void LoadFromUri(this IGraph g, Uri u)
Parameters
Type Name Description
IGraph g Graph to load into.
System.Uri u URI to load from.
Remarks

This is just a shortcut to using the static Load() methods from the UriLoader class located in the VDS.RDF.Parsing namespace.

Note: UriLoader will assign the Graph the source URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

| Improve this Doc View Source

LoadFromUri(IGraph, Uri, IRdfReader)

Loads RDF data from a URI into a Graph.
Declaration
public static void LoadFromUri(this IGraph g, Uri u, IRdfReader parser)
Parameters
Type Name Description
IGraph g Graph to load into.
System.Uri u URI to load from.
IRdfReader parser Parser to use.
Remarks

This is just a shortcut to using the static Load() methods from the UriLoader class located in the VDS.RDF.Parsing namespace.

Note: UriLoader will assign the Graph the source URI as it's Base URI unless the Graph already has a Base URI or is non-empty prior to attempting parsing. Note that any Base URI specified in the RDF contained in the file will override this initial Base URI. In some cases this may lead to invalid RDF being accepted and generating strange relative URIs, if you encounter this either set a Base URI prior to calling this method or create an instance of the relevant parser and invoke it directly.

| Improve this Doc View Source

SaveToFile(IGraph, String)

Saves a Graph to a File.
Declaration
public static void SaveToFile(this IGraph g, string file)
Parameters
Type Name Description
IGraph g Graph to save.
System.String file File to save to.
| Improve this Doc View Source

SaveToFile(IGraph, String, IRdfWriter)

Saves a Graph to a File.
Declaration
public static void SaveToFile(this IGraph g, string file, IRdfWriter writer)
Parameters
Type Name Description
IGraph g Graph to save.
System.String file File to save to.
IRdfWriter writer Writer to use.
| Improve this Doc View Source

SaveToFile(IGraph, String, IStoreWriter)

Saves a Graph to a File.
Declaration
public static void SaveToFile(this IGraph g, string file, IStoreWriter writer)
Parameters
Type Name Description
IGraph g Graph to save.
System.String file File to save to.
IStoreWriter writer Writer to use.
| Improve this Doc View Source

SaveToStream(IGraph, TextWriter, IRdfWriter)

Saves a Graph to a stream.
Declaration
public static void SaveToStream(this IGraph g, TextWriter streamWriter, IRdfWriter writer)
Parameters
Type Name Description
IGraph g Graph to save.
System.IO.TextWriter streamWriter Stream to save to.
IRdfWriter writer Writer to use.
| Improve this Doc View Source

SaveToStream(IGraph, TextWriter, IStoreWriter)

Saves a Graph to a stream.
Declaration
public static void SaveToStream(this IGraph g, TextWriter streamWriter, IStoreWriter writer)
Parameters
Type Name Description
IGraph g Graph to save.
System.IO.TextWriter streamWriter Stream to save to.
IStoreWriter writer Writer to use.
| Improve this Doc View Source

SaveToStream(IGraph, String, TextWriter)

Save a graph to a stream, determining the type of writer to use by the output file name.
Declaration
public static void SaveToStream(this IGraph g, string filename, TextWriter streamWriter)
Parameters
Type Name Description
IGraph g The graph to write.
System.String filename The output file name to use to determine the output format to write.
System.IO.TextWriter streamWriter The stream to write to.
  • Improve this Doc
  • View Source
In This Article
  • Methods
    • ExecuteQuery(IGraph, String)
    • ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, String)
    • ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlParameterizedString)
    • ExecuteQuery(IGraph, IRdfHandler, ISparqlResultsHandler, SparqlQuery)
    • ExecuteQuery(IGraph, SparqlParameterizedString)
    • ExecuteQuery(IGraph, SparqlQuery)
    • LoadFromEmbeddedResource(IGraph, String)
    • LoadFromEmbeddedResource(IGraph, String, IRdfReader)
    • LoadFromFile(IGraph, String)
    • LoadFromFile(IGraph, String, IRdfReader)
    • LoadFromString(IGraph, String)
    • LoadFromString(IGraph, String, IRdfReader)
    • LoadFromUri(IGraph, Uri)
    • LoadFromUri(IGraph, Uri, IRdfReader)
    • SaveToFile(IGraph, String)
    • SaveToFile(IGraph, String, IRdfWriter)
    • SaveToFile(IGraph, String, IStoreWriter)
    • SaveToStream(IGraph, TextWriter, IRdfWriter)
    • SaveToStream(IGraph, TextWriter, IStoreWriter)
    • SaveToStream(IGraph, String, TextWriter)
Back to top Generated by DocFX