Table of Contents

Class OdfRdfMetadata

Namespace
OdfKit.Core
Assembly
OdfKit.dll

Provides the OdfRdfMetadata API. 表示 ODF 封裝中 META-INF/manifest.rdf 的 RDF metadata 集合。

public sealed class OdfRdfMetadata
Inheritance
OdfRdfMetadata
Inherited Members

Constructors

OdfRdfMetadata()

public OdfRdfMetadata()

Properties

Triples

Provides the Triples member. 取得目前記錄的 RDF triples。

public IReadOnlyList<OdfRdfTriple> Triples { get; }

Property Value

IReadOnlyList<OdfRdfTriple>

Methods

AddTriple(OdfRdfTriple)

Adds triple. 新增一筆 RDF triple。

public void AddTriple(OdfRdfTriple triple)

Parameters

triple OdfRdfTriple

要新增的 RDF triple

Exceptions

ArgumentNullException

triplenull 時拋出

AddTriple(string, string, string)

Short overload of AddTriple that accepts subject, predicate, and objectValue; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 subject、predicate 與 objectValue;其餘可選參數使用預設值並轉呼叫最長 AddTriple 多載。

public void AddTriple(string subject, string predicate, string objectValue)

Parameters

subject string
predicate string
objectValue string

AddTriple(string, string, string, bool)

Adds triple. 新增一筆 RDF triple。

public void AddTriple(string subject, string predicate, string objectValue, bool isLiteral)

Parameters

subject string

主詞 IRI

predicate string

述詞 IRI

objectValue string

受詞值

isLiteral bool

受詞是否為 literal;若為 false,則視為資源 IRI

Exceptions

ArgumentException

當任一必要值為空白時拋出

Clear()

Performs the Clear operation. 清除全部 RDF triples。

public void Clear()

GetLinkedPartPaths(string)

Gets linked part paths. 取得指定文件主詞已連結的封裝組件路徑。

public IReadOnlyList<string> GetLinkedPartPaths(string documentSubject)

Parameters

documentSubject string

文件主詞 IRI

Returns

IReadOnlyList<string>

已正規化之組件路徑集合

GetTriples()

Short overload of GetTriples that uses default values for all optional parameters and forwards to the full overload. 便利多載:GetTriples 的所有可選參數使用預設值並轉呼叫最長多載。

public IReadOnlyList<OdfRdfTriple> GetTriples()

Returns

IReadOnlyList<OdfRdfTriple>

GetTriples(string?)

Short overload of GetTriples that accepts subject; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 subject;其餘可選參數使用預設值並轉呼叫最長 GetTriples 多載。

public IReadOnlyList<OdfRdfTriple> GetTriples(string? subject)

Parameters

subject string

Returns

IReadOnlyList<OdfRdfTriple>

GetTriples(string?, string?)

Gets RDF triples filtered by subject and predicate. 依主詞與述詞篩選 RDF triples。

public IReadOnlyList<OdfRdfTriple> GetTriples(string? subject, string? predicate)

Parameters

subject string

The subject IRI, or null to include all subjects. / 主詞 IRI;為 null 時不篩選主詞。

predicate string

The predicate IRI, or null to include all predicates. / 述詞 IRI;為 null 時不篩選述詞。

Returns

IReadOnlyList<OdfRdfTriple>

The matching triples. / 符合條件的 triple 清單。

LinkDocumentPart(string, string)

Performs link document part. 建立文件主詞與封裝組件之間的 pkg:hasPart 關聯。

public void LinkDocumentPart(string documentSubject, string partPath)

Parameters

documentSubject string

文件主詞 IRI(通常為空字串或 ./

partPath string

組件相對路徑

RemoveTriples(string)

Short overload of RemoveTriples that accepts subject; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 subject;其餘可選參數使用預設值並轉呼叫最長 RemoveTriples 多載。

public int RemoveTriples(string subject)

Parameters

subject string

Returns

int

RemoveTriples(string, string?)

Removes triples. 移除符合主詞與述詞的 RDF triples。

public int RemoveTriples(string subject, string? predicate)

Parameters

subject string

主詞 IRI

predicate string

述詞 IRI;為 null 時移除該主詞的全部 triples

Returns

int

移除的 triple 數量

SetPartMimeType(string, string)

Sets part mime type. 設定封裝組件的 pkg:mimeType literal。

public void SetPartMimeType(string partSubject, string mimeType)

Parameters

partSubject string

組件主詞 IRI

mimeType string

MIME 類型

SyncWithPackageEntries(IEnumerable<string>, IReadOnlyDictionary<string, string>)

Short overload of SyncWithPackageEntries that accepts entryPaths; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 entryPaths;其餘可選參數使用預設值並轉呼叫最長 SyncWithPackageEntries 多載。

public int SyncWithPackageEntries(IEnumerable<string> entryPaths, IReadOnlyDictionary<string, string> mediaTypes)

Parameters

entryPaths IEnumerable<string>
mediaTypes IReadOnlyDictionary<string, string>

Returns

int

SyncWithPackageEntries(IEnumerable<string>, IReadOnlyDictionary<string, string>, string?)

Performs sync with package entries. 依目前封裝項目同步 pkg:hasPartpkg:mimeType 三元組。

public int SyncWithPackageEntries(IEnumerable<string> entryPaths, IReadOnlyDictionary<string, string> mediaTypes, string? documentSubject)

Parameters

entryPaths IEnumerable<string>

封裝項目路徑集合

mediaTypes IReadOnlyDictionary<string, string>

專案路徑對應的 MIME 類型對照表

documentSubject string

文件主詞 IRI;為 null 時沿用既有 pkg:hasPart 主詞或空字串

Returns

int

新增或更新的 triple 數量

Exceptions

ArgumentNullException

entryPathsmediaTypesnull 時拋出

TryGetLiteral(string, string, out string)

Tries to get literal. 嘗試取得指定主詞與述詞的 literal 受詞。

public bool TryGetLiteral(string subject, string predicate, out string value)

Parameters

subject string

主詞 IRI

predicate string

述詞 IRI

value string

literal 受詞值

Returns

bool

若存在 literal triple 則為 true