Show / Hide Table of Contents

Class GraphExtensions

Provides useful Extension Methods for working with Graphs.

Inheritance
object
GraphExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public static class GraphExtensions

Methods

| Edit this page View Source

GetETag(IGraph)

Computes the ETag for a Graph.

Declaration
public static string GetETag(this IGraph g)
Parameters
Type Name Description
IGraph g

Graph.

Returns
Type Description
string
| Edit this page 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.

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 Parsing namespace.

| Edit this page 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.

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 Parsing namespace.

| Edit this page 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.

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 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.

| Edit this page 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.

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 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.

| Edit this page 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.

string data

Data to load.

Remarks

This is just a shortcut to using the static Parse() methods from the StringParser class located in the Parsing namespace.

| Edit this page 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.

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 Parsing namespace.

| Edit this page View Source

LoadFromUri(IGraph, Uri, IRdfReader, Loader)

Loads RDF data from a URI into a Graph.

Declaration
public static void LoadFromUri(this IGraph g, Uri u, IRdfReader parser, Loader loader = null)
Parameters
Type Name Description
IGraph g

Graph to load into.

Uri u

URI to load from.

IRdfReader parser

Parser to use.

Loader loader

Loader to use.

Remarks

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

Note: Loader 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.

| Edit this page View Source

LoadFromUri(IGraph, Uri, Loader)

Loads RDF data from a URI into a Graph.

Declaration
public static void LoadFromUri(this IGraph g, Uri u, Loader loader = null)
Parameters
Type Name Description
IGraph g

Graph to load into.

Uri u

URI to load from.

Loader loader

Loader to use.

Remarks

This is just a shortcut to using the static LoadGraph() methods from the UriLoader class located in the 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.

| Edit this page 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.

string file

File to save to.

| Edit this page 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.

string file

File to save to.

IRdfWriter writer

Writer to use.

| Edit this page 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.

string file

File to save to.

IStoreWriter writer

Writer to use.

| Edit this page 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.

TextWriter streamWriter

Stream to save to.

IRdfWriter writer

Writer to use.

| Edit this page 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.

TextWriter streamWriter

Stream to save to.

IStoreWriter writer

Writer to use.

| Edit this page 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.

string filename

The output file name to use to determine the output format to write.

TextWriter streamWriter

The stream to write to.

  • Edit this page
  • View Source
In this article
  • Methods
    • GetETag(IGraph)
    • LoadFromEmbeddedResource(IGraph, string)
    • LoadFromEmbeddedResource(IGraph, string, IRdfReader)
    • LoadFromFile(IGraph, string)
    • LoadFromFile(IGraph, string, IRdfReader)
    • LoadFromString(IGraph, string)
    • LoadFromString(IGraph, string, IRdfReader)
    • LoadFromUri(IGraph, Uri, IRdfReader, Loader)
    • LoadFromUri(IGraph, Uri, Loader)
    • 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