From: Fedja A. <ad...@ad...> - 2015-03-03 11:04:53
|
Hello dotNetRDF Team, I'm quite new to your library and RDF as well, and I have run into some performance issues I don't seem to be able to solve by myself. Not being sure whether this is a problem on my side or simply an algorithmic or implementation issue, I'm writing you for some feedback and / or help. The setup is reasonably simple: I'm using an InMemoryDataset consisting of (potentially multiple, but in this case a single) Graph(s). The dataset is very small (73 lines of Turtle) and the queries I'm performing shouldn't be too complex either. This is the code I'm using for querying: SparqlParameterizedString queryString = new SparqlParameterizedString(); queryString.CommandText = query; // []Adding namespaces here] // [Setting parameters here] SparqlQuery sparqlQuery = this.parser.ParseFromString(queryString); SparqlResultSet resultSet = this.processor.ProcessQuery(sparqlQuery) as SparqlResultSet; I'm using a SparqlQueryParser and a LeviathanQueryProcessor. Everything happens locally on my machine, no web stuff involved. The problem is that *a single ProcessQuery call takes about **5 - 7 ms*, which is too much for my purposes. I need to perform a lot of differently parameterized queries in a row. *Is there any way I could improve performance?* Calling "Optimize" on the query before executing doesn't seem to have an effect. A representative example query is this one: SELECT ?obj WHERE { ?obj Knowledge:IsA* ?actor . ?actor Knowledge:HasAttribute Knowledge:Actor . ?obj Knowledge:IsA* ?prey . @MainActor Knowledge:PredatorOf ?prey . MINUS { ?obj Knowledge:HasAttribute Knowledge:Abstract . } FILTER (!sameTerm(?obj, @MainActor)) } If you spot any wild problems in the query itself, let me know. I've also looked at some parts of the RDF Querying code and it seems like there is some kind of Algebra evaluation using classes - is there maybe a way to "Compile" them similar to C# Expression trees in order to improve performance? Regards, Adam |