Class RdfAContext
Base implementation of the IRdfAContext interface.
Implements
Inherited Members
Namespace: VDS.RDF.Parsing
Assembly: dotNetRdf.dll
Syntax
public class RdfAContext : IRdfAContext
Constructors
| Edit this page View SourceRdfAContext()
Create a new empty vocabulary.
Declaration
public RdfAContext()
RdfAContext(string, IEnumerable<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, string>>)
Create a new RDFa context with the specified default vocabulary URI, term and prefix mappings.
Declaration
public RdfAContext(string vocabularyUri, IEnumerable<KeyValuePair<string, string>> terms, IEnumerable<KeyValuePair<string, string>> prefixes)
Parameters
Type | Name | Description |
---|---|---|
string | vocabularyUri | The default vocabulary URI. If null, the context will be defined with no default vocabulary URI. |
IEnumerable<KeyValuePair<string, string>> | terms | An enumeration of key value pairs mapping each term to the URI that the term maps to. May be null. |
IEnumerable<KeyValuePair<string, string>> | prefixes | An enumeration of key value pairs mapping each prefix to the URI that the prefix maps to. May be null. |
RdfAContext(IRdfAContext)
Create a new vocabulary from an existing vocabulary.
Declaration
public RdfAContext(IRdfAContext context)
Parameters
Type | Name | Description |
---|---|---|
IRdfAContext | context | The base vocabulary to copy. |
RdfAContext(IRdfAContext, string, IEnumerable<KeyValuePair<string, string>>, IEnumerable<KeyValuePair<string, Uri>>)
Create a new vocabulary that extends an existing vocabulary and add terms and prefix mappings to it.
Declaration
public RdfAContext(IRdfAContext baseContext, string vocabularyUri, IEnumerable<KeyValuePair<string, string>> terms = null, IEnumerable<KeyValuePair<string, Uri>> prefixMappings = null)
Parameters
Type | Name | Description |
---|---|---|
IRdfAContext | baseContext | |
string | vocabularyUri | |
IEnumerable<KeyValuePair<string, string>> | terms | |
IEnumerable<KeyValuePair<string, Uri>> | prefixMappings |
Properties
| Edit this page View SourceMappings
Gets the Term Mappings.
Declaration
public IEnumerable<KeyValuePair<string, string>> Mappings { get; }
Property Value
Type | Description |
---|---|
IEnumerable<KeyValuePair<string, string>> |
NamespaceMap
Gets the namespace mappings.
Declaration
public INamespaceMapper NamespaceMap { get; }
Property Value
Type | Description |
---|---|
INamespaceMapper |
Namespaces
Gets the Namespace Mappings.
Declaration
public IEnumerable<KeyValuePair<string, string>> Namespaces { get; }
Property Value
Type | Description |
---|---|
IEnumerable<KeyValuePair<string, string>> |
VocabularyUri
Gets/Sets the Default Vocabulary URI.
Declaration
public string VocabularyUri { get; set; }
Property Value
Type | Description |
---|---|
string |
Remarks
May be NULL if the context does not define a default vocabulary URI.
Methods
| Edit this page View SourceAddNamespace(string, string)
Adds a Namespace to the Vocabulary.
Declaration
public void AddNamespace(string prefix, string nsUri)
Parameters
Type | Name | Description |
---|---|---|
string | prefix | Prefix. |
string | nsUri | Namespace URI. |
AddTerm(string, string)
Adds a Term to the Vocabulary.
Declaration
public void AddTerm(string term, string uri)
Parameters
Type | Name | Description |
---|---|---|
string | term | Term. |
string | uri | URI. |
HasTerm(string)
Gets whether a Vocabulary contains a Term.
Declaration
public bool HasTerm(string term)
Parameters
Type | Name | Description |
---|---|---|
string | term | Term. |
Returns
Type | Description |
---|---|
bool |
Load(IGraph)
Create a new RDFa context by processing the triples in the specified graph.
Declaration
public static IRdfAContext Load(IGraph g)
Parameters
Type | Name | Description |
---|---|---|
IGraph | g | The graph to process. |
Returns
Type | Description |
---|---|
IRdfAContext | A new IRdfAContext instance containing the vocabulary declaration, term and prefix mappings defined in the graph. |
Merge(IRdfAContext)
Merges another Vocabulary into this one.
Declaration
public void Merge(IRdfAContext vocab)
Parameters
Type | Name | Description |
---|---|---|
IRdfAContext | vocab | Vocabulary. |
ResolveCurie(string, Uri)
Resolve a CURIE using the namespaces defined in this vocabulary.
Declaration
public string ResolveCurie(string curie, Uri baseUri)
Parameters
Type | Name | Description |
---|---|---|
string | curie | The CURIE string to resolve. |
Uri | baseUri |
Returns
Type | Description |
---|---|
string |
ResolveTerm(string)
Resolves a Term in the Vocabulary.
Declaration
public string ResolveTerm(string term)
Parameters
Type | Name | Description |
---|---|---|
string | term | Term. |
Returns
Type | Description |
---|---|
string |