1.5.43. What are the differences between create, drop, clear and delete Graph?
In Virtuoso it does not matter whether CREATE GRAPH and DROP GRAPH are called or not. Their purpose is to provide compatibility with the original SPARUL that was designed for Jena. Some Jena triple stores require explicit creation of each graph (like CREATE TABLE in SQL), they report errors if one tries to create a graph twice and so on.
For Virtuoso, a new graph is not an important system event, it has single quad store shared by all graphs. When a graph is made by CREATE GRAPH , its name is placed in an auxiliary table that is used solely to signal appropriate errors on CREATE graph that is CREATE-d already or on DROP of a missing graph; this table is not used in any way in SPARQL or other subsystems. In a perfect world, smart development tools will query that table to give hints to a programmer regarding available graphs, but the reality is not so perfect.
What's more important is a difference between DELETE FROM g { ?s ?p ?o } FROM g WHERE { ?s ?p ?o } and CLEAR GRAPH g , as both will delete all triples from the specified graph <g> with equal speed, but CLEAR GRAPH will also delete free-text index data about occurrences of literals in this specific graph. So CLEAR GRAPH will make the database slightly more compact and the text search slightly faster. (Naturally, DROP GRAPH makes CLEAR GRAPH inside, not just DELETE FROM ... )
See Also: | |
---|---|