/// <summary> /// Removes the given triple from the graph /// </summary> public RDFGraph RemoveTriple(RDFTriple triple) { if (this.ContainsTriple(triple)) { this.Triples.Remove(triple.TripleID); RDFModelUtilities.RebuildGraph(this); } return(this); }
/// <summary> /// Removes the triples with the given literal as object /// </summary> public RDFGraph RemoveTriplesByLiteral(RDFLiteral objectLiteral) { if (objectLiteral != null) { var tripleFound = false; foreach (var triple in this.SelectTriplesByLiteral(objectLiteral)) { this.Triples.Remove(triple.TripleID); tripleFound = true; } if (tripleFound) { RDFModelUtilities.RebuildGraph(this); } } return(this); }
/// <summary> /// Removes the triples with the given resource as object /// </summary> public RDFGraph RemoveTriplesByObject(RDFResource objectResource) { if (objectResource != null) { var tripleFound = false; foreach (var triple in this.SelectTriplesByObject(objectResource)) { this.Triples.Remove(triple.TripleID); tripleFound = true; } if (tripleFound) { RDFModelUtilities.RebuildGraph(this); } } return(this); }
/// <summary> /// Removes the triples with the given (non-blank) predicate /// </summary> public RDFGraph RemoveTriplesByPredicate(RDFResource predicateResource) { if (predicateResource != null && !predicateResource.IsBlank) { var tripleFound = false; foreach (var triple in this.SelectTriplesByPredicate(predicateResource)) { this.Triples.Remove(triple.TripleID); tripleFound = true; } if (tripleFound) { RDFModelUtilities.RebuildGraph(this); } } return(this); }