Class JsonLdContext
Represents a JSON-LD context.
Inheritance
Inherited Members
Namespace: VDS.RDF.JsonLd
Assembly: dotNetRdf.dll
Syntax
public class JsonLdContext
Constructors
| Improve this Doc View SourceJsonLdContext()
Create a new empty context.
Declaration
public JsonLdContext()
JsonLdContext(Uri)
Create a new empty context with the Base and OriginalBase properties both set to the specified base URI.
Declaration
public JsonLdContext(Uri baseIri)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | baseIri | The base IRI. |
Properties
| Improve this Doc View SourceBase
Get or set the base IRI specified by this context.
Declaration
public Uri Base { get; set; }
Property Value
Type | Description |
---|---|
System.Uri |
Remarks
The value may be a relative or an absolute IRI or null.
BaseDirection
Get or set the direction used when a string does not have a direction associated with it directly.
Declaration
public LanguageDirection? BaseDirection { get; set; }
Property Value
Type | Description |
---|---|
LanguageDirection? |
InverseContext
Get the inverse context for this context.
Declaration
public JObject InverseContext { get; }
Property Value
Type | Description |
---|---|
Newtonsoft.Json.Linq.JObject |
Language
Get the default language code specified by this context.
Declaration
public string Language { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
May be null.
OriginalBase
Get the base IRI that this context was originally created with.
Declaration
public Uri OriginalBase { get; }
Property Value
Type | Description |
---|---|
System.Uri |
PreviousContext
Get or set the previous context to be used when a non-propagated context is defined.
Declaration
public JsonLdContext PreviousContext { get; set; }
Property Value
Type | Description |
---|---|
JsonLdContext |
Terms
An enumeration of the terms defined by this context.
Declaration
public IEnumerable<string> Terms { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><string> |
Version
Get or set the version of the JSON-LD syntax specified by this context.
Declaration
public JsonLdSyntax Version { get; }
Property Value
Type | Description |
---|---|
JsonLdSyntax |
Vocab
Get the default vocabulary IRI.
Declaration
public string Vocab { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
| Improve this Doc View SourceAddTerm(string, JsonLdTermDefinition)
Add a term definition to this context.
Declaration
public void AddTerm(string key, JsonLdTermDefinition termDefinition)
Parameters
Type | Name | Description |
---|---|---|
string | key | |
JsonLdTermDefinition | termDefinition |
Clone()
Create a deep clone of this context.
Declaration
public JsonLdContext Clone()
Returns
Type | Description |
---|---|
JsonLdContext | A new JsonLdContext that is a clone of this context. |
GetAliases(string)
Retrieve all mapped aliases for the given keyword.
Declaration
public IEnumerable<string> GetAliases(string keyword)
Parameters
Type | Name | Description |
---|---|---|
string | keyword |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><string> | An enumeration of the key of each term definition whose IriMapping matches the specified keyword. |
GetTerm(string, bool)
Get an existing term definition.
Declaration
public JsonLdTermDefinition GetTerm(string term, bool includeAliases = false)
Parameters
Type | Name | Description |
---|---|---|
string | term | The key for the term to be retrieved. |
System.Boolean | includeAliases | Include searching for |
Returns
Type | Description |
---|---|
JsonLdTermDefinition | The term definition found for the specified key or a default empty term definition if there is no term definition defined for that key. |
HasProtectedTerms()
Determine if this context contains any protected term definitions.
Declaration
public bool HasProtectedTerms()
Returns
Type | Description |
---|---|
System.Boolean | True if any term definition in this context is protected, false otherwise. |
HasTerm(string)
Check if this context contains a Term Definition for a specific term.
Declaration
public bool HasTerm(string term)
Parameters
Type | Name | Description |
---|---|---|
string | term | The term to check for. |
Returns
Type | Description |
---|---|
System.Boolean | True if this context contains a definition for |
RemoveBase()
Remove the base IRI from this context.
Declaration
public void RemoveBase()
Remarks
Sets Base to null.
RemoveTerm(string)
Remote an existing term definition.
Declaration
public JsonLdTermDefinition RemoveTerm(string term)
Parameters
Type | Name | Description |
---|---|---|
string | term | The key for the term to be removed. |
Returns
Type | Description |
---|---|
JsonLdTermDefinition | The removed term definition, or null if the term was not defined in this context. |
SelectTerm(string, IEnumerable<string>, string, List<string>)
Implementation of the Term Selection algorithm using this instance as the active context.
Declaration
public string SelectTerm(string iri, IEnumerable<string> containers, string typeLanguage, List<string> preferredValues)
Parameters
Type | Name | Description |
---|---|---|
string | iri | |
System.Collections.Generic.IEnumerable<T><string> | containers | |
string | typeLanguage | |
System.Collections.Generic.List<T><string> | preferredValues |
Returns
Type | Description |
---|---|
string |
SetTerm(string, JsonLdTermDefinition)
Add or update an existing term definition.
Declaration
public void SetTerm(string term, JsonLdTermDefinition definition)
Parameters
Type | Name | Description |
---|---|---|
string | term | The term key. |
JsonLdTermDefinition | definition | The new value for the term definition. |
TryGetTerm(string, out JsonLdTermDefinition, bool)
Attempt to get an existing term definition.
Declaration
public bool TryGetTerm(string term, out JsonLdTermDefinition termDefinition, bool includeAliases = false)
Parameters
Type | Name | Description |
---|---|---|
string | term | The key for the term to be retrieved. |
JsonLdTermDefinition | termDefinition | Receives the term definition found. |
System.Boolean | includeAliases | Include searching for |
Returns
Type | Description |
---|---|
System.Boolean | True if an entry was found for |