Show / Hide Table of Contents

Class JsonLdContext

Represents a JSON-LD context.

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

Constructors

| Improve this Doc View Source

JsonLdContext()

Create a new empty context.

Declaration
public JsonLdContext()
| Improve this Doc View Source

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 Source

Base

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
LanguageDirection?
| Improve this Doc View Source

InverseContext

Get the inverse context for this context.

Declaration
public JObject InverseContext { get; }
Property Value
Type Description
Newtonsoft.Json.Linq.JObject
| Improve this Doc View Source

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.

| 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
| Improve this Doc View Source

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
| Improve this Doc View Source

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>
| Improve this Doc View Source

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
| Improve this Doc View Source

Vocab

Get the default vocabulary IRI.

Declaration
public string Vocab { get; set; }
Property Value
Type Description
string

Methods

| Improve this Doc View Source

AddTerm(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
| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 term, false otherwise.

| Improve this Doc View Source

RemoveBase()

Remove the base IRI from this context.

Declaration
public void RemoveBase()
Remarks

Sets Base to null.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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
| Improve this Doc View Source

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.

| Improve this Doc View Source

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 term against the IriMapping values of the term definitions.

Returns
Type Description
System.Boolean

True if an entry was found for term, false otherwise.

Extension Methods

Extensions.ToSafeString(object)
Extensions.AsEnumerable<T>(T)
  • Improve this Doc
  • View Source
In This Article
  • Constructors
    • JsonLdContext()
    • JsonLdContext(Uri)
  • Properties
    • Base
    • BaseDirection
    • InverseContext
    • Language
    • OriginalBase
    • PreviousContext
    • Terms
    • Version
    • Vocab
  • Methods
    • AddTerm(string, JsonLdTermDefinition)
    • Clone()
    • GetAliases(string)
    • GetTerm(string, bool)
    • HasProtectedTerms()
    • HasTerm(string)
    • RemoveBase()
    • RemoveTerm(string)
    • SelectTerm(string, IEnumerable<string>, string, List<string>)
    • SetTerm(string, JsonLdTermDefinition)
    • TryGetTerm(string, out JsonLdTermDefinition, bool)
  • Extension Methods
Back to top Generated by DocFX