Class JsonLdContext
Represents a JSON-LD context.
Inheritance
System.Object
JsonLdContext
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.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.
|
Improve this Doc
View Source
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 |
---|---|
System.Nullable<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 |
---|---|
System.String |
Remarks
May be null.
|
Improve this Doc
View Source
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<System.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 |
---|---|
System.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 |
---|---|---|
System.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 |
---|---|---|
System.String | keyword |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | An enumeration of the key of each term definition whose IriMapping matches the specified keyword. |
GetTerm(String, Boolean)
Get an existing term definition.
Declaration
public JsonLdTermDefinition GetTerm(string term, bool includeAliases = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | term | The key for the term to be retrieved. |
System.Boolean | includeAliases | Include searching for term against the IriMapping values of the term definitions. |
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 |
---|---|---|
System.String | term | The term to check for. |
Returns
Type | Description |
---|---|
System.Boolean | True if this context contains a definition for term , false otherwise. |
RemoveBase()
Remove the base IRI from this context.
Declaration
public void RemoveBase()
Remarks
Sets Base to null and to false.
|
Improve this Doc
View Source
RemoveTerm(String)
Remote an existing term definition.
Declaration
public JsonLdTermDefinition RemoveTerm(string term)
Parameters
Type | Name | Description |
---|---|---|
System.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 |
---|---|---|
System.String | iri | |
System.Collections.Generic.IEnumerable<System.String> | containers | |
System.String | typeLanguage | |
System.Collections.Generic.List<System.String> | preferredValues |
Returns
Type | Description |
---|---|
System.String |
SetTerm(String, JsonLdTermDefinition)
Add or update an existing term definition.
Declaration
public void SetTerm(string term, JsonLdTermDefinition definition)
Parameters
Type | Name | Description |
---|---|---|
System.String | term | The term key. |
JsonLdTermDefinition | definition | The new value for the term definition. |
TryGetTerm(String, out JsonLdTermDefinition, Boolean)
Attempt to get an existing term definition.
Declaration
public bool TryGetTerm(string term, out JsonLdTermDefinition termDefinition, bool includeAliases = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | term | The key for the term to be retrieved. |
JsonLdTermDefinition | termDefinition | Receives the term definition found. |
System.Boolean | includeAliases | Include searching for term against the IriMapping values of the term definitions. |
Returns
Type | Description |
---|---|
System.Boolean | True if an entry was found for term , false otherwise. |