This project has moved. For the latest updates, please go here.

Get an object from context by id (without determining the type)

Oct 1, 2014 at 11:06 AM
Hi there,

Is there a way to get from the context a DataObject by the id (BrightstarDB.EntityFramework.BrightstarEntityObject) ?

I would like to get the triples related to any object by its id, without having to determine the type. Instead if using SPARQL, is there a way to get the DataObject, and then I can access the BrightstarDB.Client.DataObject triples property.

Oct 2, 2014 at 9:15 AM

Although the EntityFramework does use a DataObject internally, that is kept internal because the entity object also maintains a cache of property values taken from the triples in the DataObject and we don't want those two things getting out of sync.

I think the SPARQL route is the way to go - you can create a DataObjectStore then either use the GetDataObject() method to get the DataObject by its identity (remember this must be the full URI identifier), or you can use BindDataObjectsWithSparql to execute a SPARQL query and get an enumeration of the results as DataObject instances.

If you only want to list out the triples for a particular identity, then another alternative would be to use the low level APIs and construct your own SPARQL query to return the triples - something like:
SELECT ?p ?o WHERE { <foo> ?p ?o }
Then you can use the XDocument extensions to iterate over the results (see and
Marked as answer by techquila on 10/9/2014 at 12:26 PM
Oct 2, 2014 at 1:01 PM
Thank you :-) I used the low lever API eventually , thanks!