Federation of Static and Dynamic Data with RDF Gateway

This example demonstrates the use of RDF Gateway to perform federated queries across static and dynamic data. The static data is housed in a RDF Gateway table and is a cache of relatively static CIM data. The dynamic data is CIM data retrieved on demand from WMI via a scripted RDF Gateway dataservice.

A federated query is effectively a query against the union of the sources (as opposed to just the union of the results of the query run against each source). This means that part of the solution may exist in in one source, part in another, and the solution will be found.

All of RDF Gateway's commands that include a USING clause (e.g. SELECT, INSERT, DELETE) support multiple sources. A data source may be a disk-based table, an in-memory table, or a data service connection to an external source of data. RDF Gateway ships with data services to connect to external files (RDF, XML, HTML, text), relational databases, POP3 & SMTP mail servers, the file system, and Adobe XMP metadata. Additional dataservices can be written to connect to just about any source of data - either as a DLL supporting the open dataservice API, or as a web service.

Setup for this example:

  1. A RFDQL script gathers the CIM schema from WMI and converts into an RDF/OWL ontology
  2. A schema browser lets a user view the ontology and specify which classes are static and which are dynamic.
  3. A script is run to retrieve and cache the static data (in a more realisitic installation, this would be run periodically by a crawler and classes could have varying update intervals)
  4. A scripted dataservice is created (as a web service) to convert CIM data to RDF in real-time
  5. A single federated query is executed against both the RDF Gateway table and the dataservice.

In this example, we will query for all machines that are running a particular application and that have more than a certain amount of RAM. Which applications are running is dynamic data while the amount of installed RAM is static data. A query like this might be run as part of a report in an Asset Management System to determine which machines need memory upgrades.

Source Files

//Create a dataservice connection to the WMI web service var dsDyn = new DataSource("inet?parsetype=ntriples&url=http://localhost/demo/fed/rqi.rsp&rqi=1&user=user&pwd=pwd&index=yes"); //query for all machines running RDF Gateway that have more than 1 GB of memory select ?n using cimdata, #dsDyn where {[cim:Win32_Process_Name] ?s 'RDFSVR.exe'^^<http://www.w3.org/2001/XMLSchema#string>} and {[cim:Win32_Process_CSName] ?s ?n} and {[cim:Win32_ComputerSystem_Name] ?x ?n} and {[cim:Win32_ComputerSystem_TotalPhysicalMemory] ?x ?tfm} and integer(?tfm) > 1000000000;
Run Query (Static Only) | Run Query (Dynamic Only) | Run Query (Federated)
Query results will appear below