Class WriterHelper
Helper methods for writers.
Inherited Members
Namespace: VDS.RDF.Writing
Assembly: dotNetRdf.dll
Syntax
public static class WriterHelper
Methods
| Edit this page View SourceEncodeForXml(string)
Encodes values for use in XML.
Declaration
public static string EncodeForXml(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | Value to encode. |
Returns
Type | Description |
---|---|
string | The value with any ampersands escaped to &. |
FindAnnotations(IAnnotationCompressingWriterContext)
Finds triple annotations (triples whose subject is another triple asserted in the graph) which can be compressed into annotation constructs in some RDF syntaxes.
Declaration
public static void FindAnnotations(IAnnotationCompressingWriterContext context)
Parameters
Type | Name | Description |
---|---|---|
IAnnotationCompressingWriterContext | context | Writer context. |
FindCollections(ICollectionCompressingWriterContext)
Helper method which finds Collections expressed in the Graph which can be compressed into concise collection syntax constructs in some RDF syntaxes.
Declaration
public static void FindCollections(ICollectionCompressingWriterContext context)
Parameters
Type | Name | Description |
---|---|---|
ICollectionCompressingWriterContext | context | Writer Context. |
FindCollections(ICollectionCompressingWriterContext, CollectionSearchMode)
Helper method which finds Collections expressed in the Graph which can be compressed into concise collection syntax constructs in some RDF syntaxes.
Declaration
public static void FindCollections(ICollectionCompressingWriterContext context, CollectionSearchMode mode)
Parameters
Type | Name | Description |
---|---|---|
ICollectionCompressingWriterContext | context | Writer Context. |
CollectionSearchMode | mode | Collection Search Mode. |
GetTriplesSortedBySubjectPredicate(IGraph)
Get a list of all triples in the specified graph, sorted by subject and then predicate.
Declaration
public static List<Triple> GetTriplesSortedBySubjectPredicate(IGraph graph)
Parameters
Type | Name | Description |
---|---|---|
IGraph | graph | The graph whose triples are to be returned. |
Returns
Type | Description |
---|---|
List<Triple> | A list of the triples in |
IsValidBlankNodeID(string)
Determines whether a Blank Node ID is valid as-is when serialised in NTriple like syntaxes (Turtle/N3/SPARQL).
Declaration
public static bool IsValidBlankNodeID(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | ID to test. |
Returns
Type | Description |
---|---|
bool |
Remarks
If false is returned then the writer will alter the ID in some way.
IsValidStrictBlankNodeID(string)
Determines whether a Blank Node ID is valid as-is when serialised as NTriples.
Declaration
public static bool IsValidStrictBlankNodeID(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id |
Returns
Type | Description |
---|---|
bool |
RemoveInvalidXmlChars(string)
Removes characters invalid in XML documents.
Declaration
public static string RemoveInvalidXmlChars(string content)
Parameters
Type | Name | Description |
---|---|---|
string | content | The string to filter. |
Returns
Type | Description |
---|---|
string | New string that does not contain any invalid characters. |
SortTriplesBySubjectPredicate(List<Triple>)
Sort the provided list of triples by subject and then predicate. The list is modified in-place.
Declaration
public static void SortTriplesBySubjectPredicate(List<Triple> ts)
Parameters
Type | Name | Description |
---|---|---|
List<Triple> | ts | The list of triples to be sorted. |