SPARQL/Extensions/Subqueries
Appearance
	
	
< SPARQL | Extensions
(Redirected from SPARQL/Extensoins/Subqueries)There are several ways in which a SPARQL (sub)query might be embedded in another query.
- A) A SELECTquery could be embedded in a query's query pattern, joining its bindings with those of the parent query.
- B) A ASKquery could be used in aFILTERas a boolean condition (perhaps combined with anEXISTSoperator.
- C) A CONSTRUCTorDESCRIBEquery could be used in aFROMorFROM NAMEDclause to supply part of a query's RDF dataset.
- D) OpenLink Virtuoso supports SELECTsubqueries in all places where group patterns are allowed. Virtuoso also supports theASkeyword to rename expression as bindings that can be joined with and projected in a parent query. Future versions of Virtuoso will support the second two subquery forms mentioned above. Virtuoso also intends to implement named SPARQL views that will be similar to named SQL views; these views will be implemented as macros so any given occurrence of a view in a query will be replaced with occurrence of the body of the view in same place (with adjusted variable names). If implemented this way, view declarations can not contain invocations of the view itself, but this limitation will allow a global optimization of the query with all invoked views without writing full-scale DATALOG infrastructure.