setRDF
说明
setRDF(
将 XML/RDF 数据设置为 resource
,rdfContent
)rdfContent
指定的内容,用于 resource
指定的资源。使用commit
函数将更改应用到服务提供商。有关更多信息,请参阅生命周期协作开放服务 (OSLC) 网站上的 OSLC 中的 RDF 类和属性。
示例
获取和设置需求资源的 RDF 内容
此示例展示如何使用已配置的 OSLC 客户端获取和设置 OSLC 需求资源的 RDF 内容。
按照为需求管理域创建并配置 OSLC 客户端中所述创建并配置 OSLC 客户端myClient
后,为需求资源类型创建查询功能。
myQueryCapability = getQueryService(myClient);
向服务提供者提交可用的需求资源的查询请求。
reqs = queryRequirements(myQueryCapability)
reqs = 1×30 Requirement array with properties: ResourceUrl Dirty IsFetched Title Identifier
获取单个需求资源的完整资源属性。检查需求的标题。
myReq = reqs(1); status = fetch(myReq,myClient)
status = StatusCode enumeration OK
title = myReq.Title
title = 'My New Requirement'
获取需求资源本地存储的 RDF 内容。
rdfContent = getRDF(myReq)
rdfContent = '<?xml version="1.0" encoding="UTF-8" standalone="no" ?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_rm="http://open-services.net/ns/rm#"> <oslc_rm:Requirement> <dcterms:title>My New Requirement</dcterms:title><oslc:instanceShape rdf:resource="https://example.com/shapes/oslc-requirement-version1"/> </oslc_rm:Requirement> </rdf:RDF>'
将 rdfContent
文本复制并粘贴到新变量 newRDF
中。将 dcterms:title
属性的文本内容编辑为 My New Requirement (Edited)
。
newRDF = ['<?xml version="1.0" encoding="UTF-8" ' ... 'standalone="no" ?><rdf:RDF ' ... 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ' ... 'xmlns:dcterms="http://purl.org/dc/terms/" ' ... 'xmlns:oslc="http://open-services.net/ns/core#" ' ... 'xmlns:oslc_rm="http://open-services.net/ns/rm#">' ... '<oslc_rm:Requirement><dcterms:title>' ... 'My New Requirement (Edited)</dcterms:title>' ... '<oslc:instanceShape rdf:resource=' ... '"https://example.com/shapes/oslc-requirement-version1"/>' ... '</oslc_rm:Requirement></rdf:RDF>']
将需求的 RDF 内容设置为变量 newRDF
。检查需求标题。
setRDF(myReq,newRDF); title = myReq.Title
title = 'My New Requirement (Edited)'
将变更提交给服务提供商。
status = commit(newReq,myClient)
status = StatusCode enumeration OK
输入参数
resource
— OSLC 资源
oslc.rm.Requirement
对象 | oslc.rm.RequirementCollection
对象 | oslc.cm.ChangeRequest
对象 | ...
rdfContent
— RDF 资源数据
字符向量
OSLC 资源的 RDF 数据,指定为字符向量。
版本历史记录
在 R2021a 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)