Rowlex 从 RDF 中删除多值属性
我正在尝试从 RDF 中删除具有多值的属性,并且似乎关于此 RDF,我应该编写以下代码来删除 includeResource:
<Ontologyowl:StudyList rdf:about="stdl827181">
<Ontologyowl:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Basic learning materials</Ontologyowl:title>
<Ontologyowl:includeResource>
<Ontologyowl:LearningResource rdf:about="res298830"/>
</Ontologyowl:includeResource>
<Ontologyowl:includeResource>
<Ontologyowl:LearningResource rdf:about="res323717"/>
</Ontologyowl:includeResource>
</Ontologyowl:StudyList>
StudyList_ stdl = (StudyList_)rdfDoc.GetIndividual(stdlId, StudyList.Uri, false);
LearningResource[] lrnRes = stdl.includeResources;
foreach (LearningResource i in lrnRes)
{
stdl.RemoveincludeResource(i);
rdfDoc.RemoveProperty(...);
}
但我现在不考虑 rdfDoc.RemoveProperty(..) 输入。 请问对此有什么帮助吗?
I'm trying to remove properties with multi values, from RDF and it seems about this RDF, I should make below code for removing includeResource:
<Ontologyowl:StudyList rdf:about="stdl827181">
<Ontologyowl:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Basic learning materials</Ontologyowl:title>
<Ontologyowl:includeResource>
<Ontologyowl:LearningResource rdf:about="res298830"/>
</Ontologyowl:includeResource>
<Ontologyowl:includeResource>
<Ontologyowl:LearningResource rdf:about="res323717"/>
</Ontologyowl:includeResource>
</Ontologyowl:StudyList>
StudyList_ stdl = (StudyList_)rdfDoc.GetIndividual(stdlId, StudyList.Uri, false);
LearningResource[] lrnRes = stdl.includeResources;
foreach (LearningResource i in lrnRes)
{
stdl.RemoveincludeResource(i);
rdfDoc.RemoveProperty(...);
}
But I don't now about rdfDoc.RemoveProperty(..) inputs. Any help about this please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
rdfDoc.RemoveProperty(subject, predicate, object) 实际上要求您指定完整的三元组。 此方法由 stdl.RemoveincludeResource(i) 方法包装。 但是,您的包装方法更易于阅读并且类型安全。 宿主 C# 对象 (stdl) 是主语,方法 (RemoveincludeResource) 表示谓语,输入参数 (i) 是对象。 这些项目在内部传递给 RdfDocument.RemoveProperty 方法。 无需调用这两个方法!
rdfDoc.RemoveProperty(subject, predicate, object) actually requires you to specify the full triple. This method is wrapped by your stdl.RemoveincludeResource(i) method. However, your wrapping method is easier to read and is typesafe. The host C# object (stdl) is the subject, the method (RemoveincludeResource) represents the predicate, and the input parameter (i) will be the object. These items are passed on to the RdfDocument.RemoveProperty method internally. There is no need to call both methods!