Pregunta

I have a memory store that mixes graphs with referential data and a graph with user-bound resources. I would like to expose the data filtered by user and/or role along with all referential data.

Additionaly, I need RDFS inference on the dataset.

First, is it possible to add a reasoner to a sparqlview object or do I need to run the reasoner each time the view is refreshed ?

As for the architectural part, it seems that I have several options :

  1. Build a view per user that unions referential data and the users scope (but I cannot make the query to work with unions of different graph patterns)
  2. Build a view per user with only the data he can browse/modify and run my queries against a dataset that defaults to the union of referential graphs and user view.
  3. ...

What is the best pattern to do this with dotNetRdf in regards of query performances, memory consumption and simplicity ?

¿Fue útil?

Solución

I've never tried to do something like this with the API but it should be possible. I would probably recommend not using SparqlView implementations unless the criteria for what data can be seen by each user is only expressible as a SPARQL query, a SparqlView is fairly expensive in memory terms since it takes a copy of the original data and is not currently a direct view over the underlying data (theoretically this is possible but would require a lot more coding and would trade off lower memory usage for performance).

From what you have described I would suggest the best approach might be to use a custom ISparqlDataset implementation, likely deriving from the decorator WrapperDataset. This way you can intercept all the calls that SPARQL queries will make and restrict exactly what each instance is able to retrieve. This way you can have a single store which is the underlying data and a wrapper for each user which provides their view onto that data.

If you do this one thing you will want to be careful of is thread safety, if the underlying dataset you will be wrapping does not implement IThreadSafeDataset then you will need to ensure that all your wrappers override the Lock property and use a shared lock as otherwise you could have problems.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top