Abstract:
This invention relates to a system, method and computer program product for replicating triplestore data from generic data records including: a plurality of triplestore mapping operations; a record reader for listening for data events from the generic data record and for matching each data event to one or more triplestore mapping operations; a processor for generating equivalent triples for each located data event by applying the matched triplestore mapping operation; and a data sink for receiving generated equivalent triples so that the triplestore data is synchronized in real time with the generic data records.

Description:
BACKGROUND 
     Field of the Invention 
       [0001]    This invention relates to a method and apparatus for replicating data record events in a triplestore database in real-time. In particular this relates to a method and apparatus for populating a resource description framework (RDF) triplestore through a real-time mapping engine. 
         [0002]    A triplestore is a purpose-built database for the storage and retrieval of triples, a triple being a data entity composed of subject-predicate-object, like “John is 21” or “John knows Ted”. Much like a relational database, one stores information in a triplestore and retrieves it via a query language. Unlike a relational database, a triplestore is optimized for the storage and retrieval of triples. In addition to queries, triples can usually be imported/exported using resource description framework (RDF) and other formats. 
         [0003]    One way of replicating data as a triplestore is to use a complex extract transform load (ETL) batch jobs on the data to find, extract, transform and load the changes into a triplestore. 
         [0004]    Another approach is to monitor data and use broker flows to transform the changes. It is possible to monitor data using change data capture (CDC) techniques. Change data capture (CDC) is a set of software design patterns used to determine (and track) data that has changed so that action can be taken using the changed data. 
         [0005]    Relational database to resource descriptor framework mapping language (R2RML) is a language for expressing customized mappings from relational databases to RDF datasets. Such mappings provide the ability to view existing relational data in the RDF data model, expressed in a structure and target vocabulary of the mapping author&#39;s choice. R2RML mappings are themselves RDF graphs. R2RML enables different types of mapping implementations. 
         [0006]    D2RQ is a system for accessing relational databases as virtual, read-only RDF graphs. It offers RDF based access to the content of relational databases without having to replicate it into an RDF store. Using D2RQ: a non-RDF database can be queried; the content of a database as linked data over the Web can be accessed; custom dumps of the database in RDF formats for loading into an RDF store can be created; and information in a non-RDF database can be accessed. 
         [0007]    Current R2RML or D2RQ technologies, and the R2RML standard definition (www.w3.org/2001/sw/rdb2rdf/test-cases/) allows for reading data from relational database system (RDBMS) to expose virtual triples. Neither of these technologies pick up data events occurring at RDBMS system level (for example: insert; update and delete) and cannot be used to populate a RDF triple store in near real-time. 
       BRIEF SUMMARY OF THE INVENTION 
       [0008]    In a first aspect of the invention there is provided a system for replicating triplestore data from a generic data record comprising: a plurality of triplestore mapping operations; a record reader for listening for data events from the generic data record and for matching each data event to one or more triplestore mapping operations; a processor for generating equivalent triples for each located data event by applying the matched triplestore mapping operation; and a data sink for receiving generated equivalent triples so that the triplestore data is synchronized in real time with the data record. 
         [0009]    In a second aspect of the invention there is provided a method of replicating a triplestore data from a generic data record comprising: listening for data events from the generic data record; matching each data event to a triplestore mapping operation; generating equivalent triples for each located data event by applying the triplestore mapping operation; and pushing equivalent triples into a triplestore data sink so that the triplestore data is synchronized in real time with the data record. 
         [0010]    A real time solution is required when strict compliance and verification is needed. For example, customers like banks and government organizations have a need to query triplestore databases for auditing to provide a real-time picture of existing data records. 
         [0011]    The embodiments push all changes from remote data records into a single triplestore in real-time. Semantic queries can then be executed on this real-time representation of all data assets. Real-time in this specification is soft-real time, that is as fast as possible and as close as real time as possible but not necessarily absolutely constrained. Therefore it is not necessarily based on interruption with time/resources constraints. 
         [0012]    The embodiments have a quickening effect on any processes that rely on a triplestore database. The embodiments operate at system level of a computer system and below an overlying application level. The embodiments increase the reliability of applications since real-time data is the most up-to-date. 
         [0013]    Similar queries using R2RML or D2RQ engines would put extra load on a RDBMS. Furthermore security risks would be introduced by allowing an extra RDF or RDF query language (SPARQL) application to access the RDBMS. 
         [0014]    Advantageously the triplestore database comprises one of: a triplestore data sink; or a triplestore database system. 
         [0015]    A further replication sink is advantageous because of pre-existing transformation capabilities, that is: ETL normalization (for instance for IBM DataStage); message queue fan out to multiple RDF stores (for instance for IBM MQ or Java Message System); and multiple RDF save replicas. IBM DataStage is an ETL system. IBM MQ is a messaging system that uses queues to transfer messages between connected systems. IBM, DataStage and MQ are registered or unregistered trademarks of International Business Machines in the US and/or other countries. Java is a registered or unregistered trademark of Oracle Corporation in the US and/or other countries. 
         [0016]    More advantageously, two or more triples are created for each data event according to user defined R2RMI mapping. 
         [0017]    Still more advantageously, the data event is one or more of: an insert event; a delete event; or an update event. 
         [0018]    Yet more advantageously, triplestore data is injected into the triplestore storage using a known application programming interface (API). For instance, one such triplestore API is the Apache Jena framework. Apache Jena is an open source Java framework for building semantic Web and linked data applications. 
         [0019]    Preferably data events include events from one or more of the following: database replication; data modification; change data capture (CDC) events; events from platform messaging systems; events from event load transfer (ELT) systems; and events from structured query language (SQL) replication. 
         [0020]    More preferably the method is scaled for listening to multiple data event sources simultaneously. The method uses fast or parallel processors. Data event sources can be pushing thousands of events per second. One data record change can generate multiple triples or triple changes (at least one per file in the record plus types and others relevant concepts defined by the R2RML mapping). Therefore the R2RML transformations need to be nimble, for example, pre-calculated as templates in memory, so that data from before and after record images is transformed as efficiently as possible into the mappings. Mapping needs to be applied in parallel as efficiently as possible, for example, by loading the RDF model graph in memory and then persisting it all at once. 
         [0021]    In a third aspect of the invention there is provided a computer program product for replicating information from a relational database as a triplestore database, the computer program product comprising a computer-readable storage medium having computer-readable program code embodied therewith and the computer-readable program code configured to perform all the steps of the methods. 
         [0022]    The computer program product comprises a series of computer-readable instructions either fixed on a tangible medium, such as a computer readable medium, for example, optical disk, magnetic disk, solid-state drive or transmittable to a computer system, using a modem or other interface device, over either a tangible medium, including but not limited to optical or analogue communications lines, or intangibly using wireless techniques, including but not limited to microwave, infrared or other transmission techniques. The series of computer readable instructions embodies all or part of the functionality previously described. 
         [0023]    Those skilled in the art will appreciate that such computer readable instructions can be written in a number of programming languages for use with many computer architectures or operating systems. Further, such instructions may be stored using any memory technology, present or future, including but not limited to, semiconductor, magnetic, or optical, or transmitted using any communications technology, present or future, including but not limited to optical, infrared, or microwave. It is contemplated that such a computer program product may be distributed as a removable medium with accompanying printed or electronic documentation, for example, shrink-wrapped software, pre-loaded with a computer system, for example, on a system ROM or fixed disk, or distributed from a server or electronic bulletin board over a network, for example, the Internet or World Wide Web. 
         [0024]    In a fourth aspect of the invention there is provided a computer program stored on a computer readable medium and loadable into the internal memory of a computer, comprising software code portions, when said program is run on a computer, for performing all the steps of the method claims. 
         [0025]    In a fifth aspect of the invention there is provided a data carrier aspect of the preferred embodiment that comprises functional computer data structures to, when loaded into a computer system and operated upon thereby, enable said computer system to perform all the steps of the method claims. A suitable data-carrier could be a solid-state memory, magnetic drive or optical disk. Channels for the transmission of data may likewise comprise storage media of all descriptions as well as signal-carrying media, such as wired or wireless signal-carrying media. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0026]    Preferred embodiments of the present invention will now be described, by way of example only, with reference to the following drawings in which: 
           [0027]      FIG. 1A  is a schematic deployment diagram of a transformation system of the preferred embodiment; 
           [0028]      FIG. 1B  is a computer based deployment of the transformation of the preferred embodiment; 
           [0029]      FIG. 2  is a component diagram of the preferred embodiment; and 
           [0030]      FIG. 3  is a flow diagram of a process of the preferred embodiment. 
       
    
    
     DETAILED DESCRIPTION OF THE EMBODIMENTS 
       [0031]    Referring to  FIG. 1A , the deployment of a preferred embodiment is shown. Transformation system  10  comprises: data records  2 ; data events  3 ; transformation engine  4 ; triplestore database  5 ; metadata management  6 ; R2RML mappings  7  and console management  8 . 
         [0032]    Data records  2  are the source of the data events that are intercepted by the preferred embodiment. Data records  2  are designed for use by external systems but these external systems are not part of the embodiments. Data records  2  can comprise: Oracle databases; IBM DB2 databases; SQL Servers; or any other data records including simple data tables or extensible mark-up language (XML) data. 
         [0033]    Data events  3  are intercepted and are piped to transformation engine  4 . 
         [0034]    Transformation engine  4  is for transforming the data events into triplestore data and is described in more detail below. 
         [0035]    Triplestore database  5  is for receiving the transformed data events from RDF message queues or ELT RDF stages or any other type of record feed into a triplestore database. 
         [0036]    Metadata management  6  is for creating triplestore transformation mappings between data events that might occur for data records  2  and equivalent triplestore data. These mappings are stored in R2RML mappings  7 . 
         [0037]    R2RML mappings  7  are for storing the transformational mappings between data events and triplestore data. The transformation engine  4  fetches individual R2RML mapping for use in the transformation. 
         [0038]    Console management  8  is used by administrators to operate and manage transformation engine  4 . 
         [0039]    Referring to  FIG. 1B , the deployment of a preferred embodiment in a computer system is described. Transformation system  10  is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing processing systems, environments, and/or configurations that may be suitable for use with transformation system  10  include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments that include any of the above systems or devices. 
         [0040]    Transformation system  10  may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer processor. Generally, program modules may include routines, programs, objects, components, logic, and data structures that perform particular tasks or implement particular abstract data types. Transformation system  10  may be embodied in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media including memory storage devices. 
         [0041]    Console management  8  includes one or more input devices  14  and output devices  16  directly attached to the transformation engine  4 . Transformation system  10  is connected to a network  20 . Transformation system  10  communicates with a user  18  using input devices  14  and output devices  16 . Input devices  14  include one or more of: a keyboard, a scanner, a mouse, trackball or another pointing device. Output devices  16  include one or more of a display or a printer. Transformation system  10  communicates with network devices (not shown) over network  20 . Network  20  can be a local area network (LAN), a wide area network (WAN), or the Internet. 
         [0042]    Transformation engine  4  is based on a general purpose computer and comprises: central processing unit (CPU)  22 ; network adapter  24 ; device adapter  26 ; bus  28  and memory  30 . 
         [0043]    CPU  22  loads machine instructions from memory  30  and performs machine operations in response to the instructions. Such machine operations include: incrementing or decrementing a value in register (not shown); transferring a value from memory  30  to a register or vice versa; branching to a different location in memory if a condition is true or false (also known as a conditional branch instruction); and adding or subtracting the values in two different registers and loading the result in another register. A typical CPU can perform many different machine operations. A set of machine instructions is a machine code program; the machine code program is written in machine code language which is a low level language. A computer program written in a high level language needs to be compiled to a machine code program before it can be run. Alternatively a machine code program such as a virtual machine or an interpreter can interpret a high level language in terms of machine operations. 
         [0044]    Network adapter  24  is connected to bus  28  and network  20  for enabling communication between the transformation engine  4  and network devices. 
         [0045]    Device adapter  26  is connected to bus  28  and input devices  14  and output devices  16  for enabling communication between transformation engine  4  and input devices  14  and output devices  16 . 
         [0046]    Bus  28  couples the main system components together including memory  30  to CPU  22 . Bus  28  represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnects (PCI) bus. 
         [0047]    Memory  30  includes computer system readable media in the form of volatile memory  32  and non-volatile or persistent memory  34 . Examples of volatile memory  32  are random access memory (RAM)  36  and cache memory  38 . Generally volatile memory is used because it is faster and generally non-volatile memory is used because it will hold the data for longer. Transformation system  10  may further include other removable and/or non-removable, volatile and/or non-volatile computer system storage media. By way of example only, persistent memory  34  can be provided for reading from and writing to a non-removable, non-volatile magnetic media (not shown and typically a magnetic hard disk or solid-state drive). Although not shown, further storage media may be provided including: an external port for removable, non-volatile solid-state memory; and an optical disk drive for reading from or writing to a removable, non-volatile optical disk such as a compact disk (CD), digital video disk (DVD) or Blu-ray. In such instances, each can be connected to bus  28  by one or more data media interfaces. As will be further depicted and described below, memory  30  may include at least one program product having a set (for example, at least one) of program modules that are configured to carry out the functions of embodiments of the invention 
         [0048]    The set of program modules configured to carry out the functions of the preferred embodiment comprises transformation engine module  200  and R2RML mappings module  201 . Further program modules that support the preferred embodiment but are not shown include firmware, boot strap program, operating system, and support applications. Each of the operating system, support applications, other program modules, and program data or some combination thereof, may include an implementation of a networking environment. 
         [0049]    Transformation system  10  communicates with at least one network  20  (such as a local area network (LAN), a general wide area network (WAN), and/or a public network like the Internet) via network adapter  24 . Network adapter  24  communicates with the other components of transformation engine  4  via bus  28 . It should be understood that although not shown, other hardware and/or software components could be used in conjunction with transformation system  10 . Examples, include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, redundant array of independent disks (RAID), tape drives, and data archival storage systems. 
         [0050]    Referring to  FIG. 2 , transformation engine module  200  comprises the following components: record reader  204 ; R2RML processor  206 ; data sink  208 ; SQL (sequence query language) processing engine  210 ; and transformation method  300 . 
         [0051]    Record reader  204  is for reading the record data and fetching one or more R2RML mapping files. Record reader  204  is also for gathering metadata from the record data; this information can be read from a configuration file, metadata server or as extra annotations in previously mentioned R2RML mapping file. Record reader  204  is also for gathering runtime parameters from the record data; for example: multiple sections; concurrent threads; logging data; RDF store connection parameters; metadata server connection parameters; MQ Broker connection and subscriptions; and CDC connection parameters. The record data, mapping files, metadata and parameters are passed onto R2RML processor  206 . 
         [0052]    R2RML processor  206  is for operating on the record data, mapping files, metadata and parameters to effect a transformation of the record data. R2RML processor  206  accepts the following inputs: before and after images of database records; the SQL operation types INSERT, DELETE, UPDATE; and table definitions. This component manages triple creation based on the R2RML mapping definitions. If the R2RML logical table definition in the R2RML file is a simple expression with no SQL then the mapping into multiple triples is done in memory directly. If the R2RML logical table definition in the R2RML file uses SQL (using a SELECT statement for instance) then R2RML processor  206  call SQL processing engine  210 . 
         [0053]    Data sink  208  is a buffering triplestore for taking all the triples generated by R2RML processor  206  and doing one or more of the following: 1) Using a SPARQL JENA API to inject triples directly into the RDF store; 2) Using an ELT stage to push triples in an RDF store; 3) Using a platform messaging queue to push triples to publish and subscribe listeners; or 4) Using CDC listeners to push the triples to other replicated triple stores. 
         [0054]    SQL processing engine  210 , (for example an embedded Apache Derby database) is used for the sole purpose of processing the SQL statements by replacing the tables names in the FROM clause (“FROM TABLE1”) with “VALUES (‘field1’, ‘field2’, . . . ‘fieldN’) as TABLE1 (fieldname1, fieldname2, . . . fieldnameN)” clauses so that the SQL processing engine can process triples without a real table created on disk (for speed and agility purposes). Apache Derby, a database subproject of the Apache code community, is an open source relational database implemented entirely in Java and available under the Apache License, Version 2.0. Apache Derby is particularly useful if the R2RML SQL statement specified use CASE statements or any static reference data tables (for example currencies or countries). Eventually, if the reference data set is large, reference data tables can be loaded in the in-memory SQL processing engine if they fit, or as usual SQL processing engine tables with persistence if more data is required and this cannot all fit in memory. 
         [0055]    Referring to  FIG. 3 , transformation method  300  comprises logical process steps  302  to  314 . 
         [0056]    Step  304  is for listening for data events. 
         [0057]    Step  306  is for matching event data to mapping transformations. 
         [0058]    Step  308  is for generating equivalent triples. 
         [0059]    Step  310  is for pushing triples to the data sink. 
         [0060]    Step  312  is for deciding to continue to listen for data events at step  304  else step  314 . 
         [0061]    Step  314  is the end of transformation method  300 . 
         [0062]    Further embodiments of the invention are now described. It will be clear to one of ordinary skill in the art that all or part of the logical process steps of the preferred embodiment may be alternatively embodied in a logic apparatus, or a plurality of logic apparatus, comprising logic elements arranged to perform the logical process steps of the method and that such logic elements may comprise hardware components, firmware components or a combination thereof. 
         [0063]    It will be equally clear to one of skill in the art that all or part of the logic components of the preferred embodiment may be alternatively embodied in logic apparatus comprising logic elements to perform the steps of the method, and that such logic elements may comprise components such as logic gates in, for example a programmable logic array or application-specific integrated circuit. Such a logic arrangement may further be embodied in enabling elements for temporarily or permanently establishing logic structures in such an array or circuit using, for example, a virtual hardware descriptor language, which may be stored and transmitted using fixed or transmittable carrier media. 
         [0064]    In a further alternative embodiment, the present invention may be realized in the form of a computer implemented method of deploying a service comprising steps of deploying computer program code operable to, when deployed into a computer infrastructure and executed thereon, cause the computer system to perform all the steps of the method. 
         [0065]    It will be appreciated that the method and components of the preferred embodiment may alternatively be embodied fully or partially in a parallel computing system comprising two or more processors for executing parallel software. 
         [0066]    It will be clear to one skilled in the art that many improvements and modifications can be made to the foregoing exemplary embodiment without departing from the scope of the present invention.