Rowlex 从 RDF 中删除多值属性

发布于 2024-07-26 23:53:27 字数 990 浏览 5 评论 0原文

我正在尝试从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

音栖息无 2024-08-02 23:53:27

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文