Hi Gianluca
Namespaces are no longer persisted in the new SQL Store, they were only ever persisted as a convinience in the old store and the decision was made not to do this in the new store. If this is an important feature to you it could potentially be added back into future versions of the store but we would only do this as a vanity feature i.e. they would not change how we persist URIs into the store.
To handle namespaces you should use the APIs, so when you create a Graph into which you are going to load data use the NamespaceMap property to register relevant namespaces for your data to be used when outputting it e.g.
Graph g = new Graph();
g.NamespaceMap.Add("ex", new Uri("http://example.org";));
g.NamespaceMap.Add("foaf", new Uri("http://xmlns.com/foaf/0.1/";));
If you use a whole bunch of namespaces regularly it might be easiest to create an extension method that you can simply call to automatically register all your common namespaces.
SqlGraph has been deprecated for a while and was superceded by the StoreGraphPersistenceWrapper which is a wrapper graph that can be placed around any graph backed by a IGenericIOManager instance and ensures any changes are persisted.
This has some advantages over the old SqlGraph in terms of both how it is implemented, the number of supported stores and its ability to provide API level transactionality i.e. changes are made in-memory first and then either persisted(using the Flush() metho or discarded using the Discard() method.
Usage is roughly as follows, see [2] for another example:
//Assume you have a MicrosoftAdoManager open already in a variable called manager
//Create a wrapper - this constructor loads the graph from the store if the third parameter is
//false
//Please check [1] for exact behaviour as some constructors require a preloaded
//base graph while others do not
StoreGraphPersistenceWrapper wrapper = new StoreGraphPersistenceWrapper(manager, new Uri("http://example.org/graph";), false);
//Now make some changes to the Graph...
//Finally persist them
wrapper.Flush();
Note that if you don't explicitly flush the changes the wrapper will automatically persist outstanding changes when you either Dispose() of it or when it gets finalized if you didn't call Dispose() explicitly.
Hope this helps, let me know if you have more questions on this
Best Regards,
Rob Vesse
[1]: http://dotnetrdf.org/api/index.asp?Topic=VDS.RDF.StoreGraphPersistenceWrapper
[2]: http://www.dotnetrdf.org/content.asp?pageID=Working%20with%20Graphs
----------------------------------------
From: "gianluca" <gianluca@...>
Sent: 05 October 2011 14:09
To: rvesse@...
Subject: Some problems with MicrosoftAdoManager
Rob,
I'm trying to use the new
MicrosoftAdoManager class with Sql Server.
However, it seems to be some problems with namespaces, which are not persisted,
when saving the graph. It seems they are completely ignored, even in the
database. How are they supposed to be handled?
Are you planning to add a new SqlGraph class
backed by MicrosoftAdoManager?
TIA,
gianluca
|