Administrator
|
Hi,
You cannot perform SPARQL directly on an sqlite3 file. You need to use Python and Owlready for that, because Owlready is in charge of translating SPARQL to SQL.
However, you can :
* Perform SPARQL queries on the sqlite3 file with Owlready, without loading any ontologies -- even if the quadstore is very big, this can be efficient, depending of the query.
* Use Owlready to translate predefined SPARQL queries to SQL, and then run the SQL queries directly in sqlite3. You can use the .sql attribute of a prepared SPARQL query to obtain the corresponding SQL code, for example :
>>> default_world.prepare_sparql("SELECT ?c {?c a owl:Class}").sql
'SELECT q1.s FROM objs q1 WHERE q1.p=6 AND q1.o=11'
Jiba
|