public override IDataObject GetDataObject(string identity) { if (identity == null) throw new ArgumentNullException("identity"); var resolvedIdentity = ResolveIdentity(identity); var dataObject = new DataObject(this, resolvedIdentity); BindDataObject(dataObject); RegisterDataObject(dataObject); return dataObject; }
/// <summary> /// Returns the tracked data object for a given input data object /// </summary> /// <param name="p">The data object to be tracked</param> /// <returns>The tracked data object for the same identity as <paramref name="p"/></returns> /// <remarks>If <paramref name="p"/> has an identity which matches an existing tracked data object, /// then the existing tracked data object is returned, otherwise <paramref name="p"/> is added /// to the data object tracker and returned.</remarks> protected DataObject RegisterDataObject(DataObject p) { DataObject existing; if (_managedProxies.TryGetValue(p.Identity, out existing)) return existing; _managedProxies.Add(p.Identity, p); return p; }
public override bool BindDataObject(DataObject dataObject) { return dataObject.BindTriples(GetTriplesForDataObject(dataObject.Identity)); }
/// <summary> /// Change the URI identifier for this data object. /// </summary> /// <remarks>This change will update all triples where the data object identity /// is the subject or object. It will not change predicates.</remarks> /// <param name="newIdentity">The new URI identifier</param> /// <param name="enforceClassUniqueConstraint">Add an update precondition to ensure that the update will fail if the store already /// contains an RDF resource with the same rdf:type(s) as this data object.</param> public IDataObject UpdateIdentity(string newIdentity, bool enforceClassUniqueConstraint) { if (newIdentity == null) throw new ArgumentNullException("newIdentity", "DataObject Identity must not be null"); if (String.IsNullOrWhiteSpace(newIdentity)) throw new ArgumentException("DataObject Identity must not be an empty string or whitespace.", "newIdentity"); if (newIdentity.Equals(Identity)) { // No change return this; } if (IsNew) { // Simple case - we only have to change the uncommitted triples locally. CheckLoaded(); var ret = new DataObject(_store, newIdentity, true); ret.BindTriples(_triples.Select(t => ReplaceIdentity(t, newIdentity)), true, enforceClassUniqueConstraint); _store.ReplaceIdentity(Identity, newIdentity); Delete(); return ret; } else { CheckLoaded(); var ret = new DataObject(_store, newIdentity, true); ret.BindTriples(_triples.Union(_store.GetReferencingTriples(this)).Select(t => ReplaceIdentity(t, newIdentity)), true, enforceClassUniqueConstraint); _store.ReplaceIdentity(Identity, newIdentity); Delete(); return ret; } }
public override bool BindDataObject(DataObject dataObject) { var triples = GetFilteredResourceStatements(_storeName, dataObject.Identity); return dataObject.BindTriples(triples); }
public override bool BindDataObject(DataObject dataObject) { IEnumerable<Triple> triples = _serverCore.GetResourceStatements(_storeName, dataObject.Identity); return dataObject.BindTriples(triples); }
public override bool BindDataObject(DataObject dataObject) { var triples = GetFilteredResourceStatements(_storeName, dataObject.Identity); return(dataObject.BindTriples(triples)); }
public override bool BindDataObject(DataObject dataObject) { return(dataObject.BindTriples(GetTriplesForDataObject(dataObject.Identity))); }