Singleton Property Reasoning
From Knoesis wiki
Contents
Downloads
The packages are available for download at sourceforge.net
LUBM-SP: http://sourceforge.net/projects/graphke/files/lubmsp_1.0.0.jar/download
LUBM-SP ontology: http://sourceforge.net/projects/graphke/files/lubmsp_onto.nt/download
SPARQL queries http://sourceforge.net/projects/graphke/files/queries.tar.gz/download
Jena Query evaluation http://sourceforge.net/projects/graphke/files/lubmsp_query_eval_1.0.0.jar/download
Instructions
Setting up files
1. mkdir lubmsp 2. cd lubmsp 3. Download all the files provided in the Download section above into this folder 4. tar -xzvf queries.tar.gz 5. You may want to install the rlwrap package for command history
Here we explain the step-by-step to generate the LUBM-SP datasets, and run the query evaluation
Generating LUBM and LUBM-SP datasets
1. cd lubmsp 2. Run the code, the number of university may be 50, 500, or 1000 java -jar lubmsp_1.0.0.jar -univ 500 -index 0 -onto http://knoesis.org/lubmsp 3. Check for three data files generated LUBM_500.nt: the original LUBM in the form of ntriples LUBM_500_sp.nt: the LUBM-SP in the form of ntriples LUBM_500.rdf: the original LUBM in the form of RDF/XML
Query evaluation in Jena
1. cd lubmsp 2. java -jar lubmsp_query_eval_1.0.0.jar or rlwrap java -jar lubmsp_query_eval_1.0.0.jar reasoner: rdfs ontology: lubmsp_onto.nt instances: LUBM_500_sp.nt query: queries/lubm_query1.sparql
Preparing Oracle 12c
1. Download and install Oracle database 12c to $ORACLE_HOME 2. Download and install Oracle client: sqlplus 3. Create one Oracle instance using dbca 4. Connect to sqlplus sqlplus / as sysdba 4. Execute the two files $ORACLE_HOME/md/admin/catsem.sql and $ORACLE_HOME/md/admin/sdordfwm.sql SQL> @'?/md/admin/catsem.sql' SQL> @'?/md/admin/sdordfwm.sql' 5. Create a tablespace rdf_tblspace 6. Create a semantic network on the tablespace rdf_tblspace
Below is the sample code for loading LUBM_500_sp.nt to Oracle
connect user/pass set timing on create table stable_lubmsp_500 ( RDF$STC_sub varchar2(4000) not null, RDF$STC_pred varchar2(4000) not null, RDF$STC_obj varchar2(4000) not null); grant SELECT on stable_lubmsp_500 to MDSYS; CREATE TABLE RDF$ET_TAB_LUBMSP_500 ( proc_sid VARCHAR2(30), proc_sig VARCHAR2(200), event_name varchar2(200), start_time timestamp, end_time timestamp, start_comment varchar2(1000) DEFAULT NULL, end_comment varchar2(1000) DEFAULT NULL ); GRANT INSERT on RDF$ET_TAB_LUBM_500 to MDSYS; host sqlldr userid=user/pass control=/path/to/lubmsp/bulkload_lubmsp_500.ctl data=/path/to/lubmsp/LUBM_500_sp.nt direct=true rows=10000000 skip_index_maintenance=true skip=0 load=1000000000 discardmax=1000000 bad=d0.bad discard=d0.rej log=d0.log errors=1000000 host sqlldr userid=user/pass control=/path/to/lubmsp/bulkload_lubmsp_500.ctl data=/path/to/lubmsp/lubmsp_onto.nt direct=true skip=0 load=1000000000 discardmax=1000000 bad=d0.bad discard=d0.rej log=d0.log errors=1000000 commit; create table atab_lubmsp_500 (triple sdo_rdf_triple_s); exec sem_apis.create_sem_model('LUBMSP_500_MODEL', 'ATAB_LUBMSP_500', 'TRIPLE'); grant INSERT,UPDATE on atab_lubmsp_500 to MDSYS; exec sem_apis.bulk_load_from_staging_table(model_name=>'LUBMSP_500_MODEL', table_owner=>'vinh', table_name=>'stable_lubmsp_500'); commit; select count(*) from table(sem_match('{?s ?p ?o}', SEM_MODELS('LUBMSP_500_MODEL'), NULL, NULL, NULL)); INSERT INTO ATAB_LUBMSP_500 VALUES ( SDO_RDF_TRIPLE_S('LUBMSP_500_MODEL', '<http://www.w3.org/1999/02/22-rdf-syntax-ns#singletonPropertyOf>', '<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>', '<http://www.w3.org/2000/01/rdf-schema#subPropertyOf>')); commit; EXEC SEM_APIS.CREATE_ENTAILMENT('rdfs_rix_lubmsp_500', SEM_Models('LUBMSP_500_MODEL'), SEM_Rulebases('RDFS')); commit;
Loading data to Oracle 12c
There are different ways to load data into Oracle. Here we use the bulk load from staging table method.