Question

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?

Was it helpful?

Solution

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top