Show / Hide Table of Contents

Class JsonLdContext

Represents a JSON-LD context.

Inheritance
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

| Edit this page View Source

JsonLdContext()

Create a new empty context.

Declaration
public JsonLdContext()
| Edit this page 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
Uri baseIri

The base IRI.

Properties

| Edit this page View Source

Base

Get or set the base IRI specified by this context.

Declaration
public Uri Base { get; set; }
Property Value
Type Description
Uri
Remarks

The value may be a relative or an absolute IRI or null.

| Edit this page 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?
| Edit this page View Source

InverseContext

Get the inverse context for this context.

Declaration
public JObject InverseContext { get; }
Property Value
Type Description
JObject
| Edit this page 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.

| Edit this page View Source

OriginalBase

Get the base IRI that this context was originally created with.

Declaration
public Uri OriginalBase { get; }
Property Value
Type Description
Uri
| Edit this page 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
| Edit this page View Source

Terms

An enumeration of the terms defined by this context.

Declaration
public IEnumerable<string> Terms { get; }
Property Value
Type Description
IEnumerable<string>
| Edit this page 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
| Edit this page View Source

Vocab

Get the default vocabulary IRI.

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

Methods

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

| Edit this page 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
IEnumerable<string>

An enumeration of the key of each term definition whose IriMapping matches the specified keyword.

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

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

| Edit this page View Source

HasProtectedTerms()

Determine if this context contains any protected term definitions.

Declaration
public bool HasProtectedTerms()
Returns
Type Description
bool

True if any term definition in this context is protected, false otherwise.

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

True if this context contains a definition for term, false otherwise.

| Edit this page View Source

RemoveBase()

Remove the base IRI from this context.

Declaration
public void RemoveBase()
Remarks

Sets Base to null.

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

| Edit this page 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
IEnumerable<string> containers
string typeLanguage
List<string> preferredValues
Returns
Type Description
string
| Edit this page 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.

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

bool includeAliases

Include searching for term against the IriMapping values of the term definitions.

Returns
Type Description
bool

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

Extension Methods

Extensions.ToSafeString(object)
Extensions.AsEnumerable<T>(T)
  • Edit this page
  • 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