/// <summary> /// Removes the given triple from the graph /// </summary> public RDFGraph RemoveTriple(RDFTriple triple) { if (this.ContainsTriple(triple)) { //Remove triple this.Triples.Remove(triple.TripleID); //Remove index this.GraphIndex.RemoveIndex(triple); //Raise event RDFModelEvents.RaiseOnTripleRemoved(String.Format("Triple '{0}' has been removed from the Graph '{1}'.", triple, this)); } return(this); }
/// <summary> /// Removes the triples with the given literal as object /// </summary> public RDFGraph RemoveTriplesByLiteral(RDFLiteral objectLiteral) { if (objectLiteral != null) { foreach (var triple in this.SelectTriplesByLiteral(objectLiteral)) { //Remove triple this.Triples.Remove(triple.TripleID); //Remove index this.GraphIndex.RemoveIndex(triple); //Raise event RDFModelEvents.RaiseOnTripleRemoved(String.Format("Triple '{0}' has been removed from the Graph '{1}'.", triple, this)); } } return(this); }
/// <summary> /// Removes the triples with the given (non-blank) predicate /// </summary> public RDFGraph RemoveTriplesByPredicate(RDFResource predicateResource) { if (predicateResource != null && !predicateResource.IsBlank) { foreach (var triple in this.SelectTriplesByPredicate(predicateResource)) { //Remove triple this.Triples.Remove(triple.TripleID); //Remove index this.GraphIndex.RemoveIndex(triple); //Raise event RDFModelEvents.RaiseOnTripleRemoved(String.Format("Triple '{0}' has been removed from the Graph '{1}'.", triple, this)); } } return(this); }
/// <summary> /// Removes the triples with the given subject /// </summary> public RDFGraph RemoveTriplesBySubject(RDFResource subjectResource) { if (subjectResource != null) { foreach (RDFTriple triple in this.SelectTriplesBySubject(subjectResource)) { //Remove triple this.Triples.Remove(triple.TripleID); //Remove index this.GraphIndex.RemoveIndex(triple); //Raise event RDFModelEvents.RaiseOnTripleRemoved(String.Format("Triple '{0}' has been removed from the Graph '{1}'.", triple, this)); } } return(this); }