sexta-feira, 22 de julho de 2011

Files and tutorial

Here we make accessible the code and the data used for the tests in the C. Damásio, F. Ferreira, "Practical RDF Schema reasoning with annotated Semantic Web data" paper.

A zip archive with all the files can be downloaded here.

The archive contents are organized in the following way:
  • A directory "database" with the database script.
  • A "scripts" directory containing .sql files with the implementation of all the inference rules. Each file has the implementation using a different method.
  • A "test_data" directory with the data for each test used in the paper.
  • A .sql file "rules_script" used to run the rules for graph closure in the order defined in the paper.

The tests and the code were used in PostgresSQL.
In order to test the code the following steps should be made:
  • Create a new database and run the database_script.sql to create the necessary sequences, tables, and functions needed.
  • Load the data of the test into de database. The data contained in the archive is already ready for use, so there is only the need to bulk upload it. In PostgresSQL that can be done with  COPY.
    For example if in this case we want to use Test 5 and if the "ISWC_files" directory is in 'D:/' the upload code should be:
    copy "Resources" FROM 'D:/ISCW_files/test_data/T5/resources.txt';
    copy "Triples" FROM 'D:/ISCW_files/test_data/T5/triples.txt';
    copy "rdfs:domain" FROM 'D:/ISCW_files/test_data/T5/domain.txt';
    copy "rdfs:range" FROM 'D:/ISCW_files/test_data/T5/range.txt';
    copy "rdfs:subClassOf" FROM 'D:/ISCW_files/test_data/T5/sc.txt';
    copy "rdfs:subPropertyOf" FROM 'D:/ISCW_files/test_data/T5/sp.txt';
    copy "rdf:type" FROM 'D:/ISCW_files/test_data/T5/type.txt';

    If the desired test is Test 1 (which like tests 2, 3 and 4 only contains subclass data) the code should be:
    copy "Resources" FROM 'D:/ISCW_files/test_data/T1/resources.txt';
    copy "rdfs:subClassOf" FROM 'D:/ISCW_files/test_data/T1/sc.txt';
  • Next we need the rules implementation. Each file in the "scripts" directory contains de rules implementation for each different method referred in the paper.
    For this example we would like to try the Logarithmic algorithm implementation logarithmic_script.sql. After running this script it's all set.
  • The last step is to run execute the rules. The rules execution in the proper order is obtained by running the rules_script.sql file.
    Keep in mind that Tests 1, 2, 3 and 4 only contain subclass data and as such dont need the execution of all the rules. In these tests only the rule 2A is needed. So instead of the above script simply execute the commands:
    BEGIN;
    SELECT Rule2a(1);
    COMMIT;


    The "scripts" directory file names match the following closure methods discussed in the paper:
    diferential_sn_script.sql => Differential Semi-Näive method
    logarithmic_script.sql => Logarithmic Method
    matrix_script.sql  => Matrix multiplication Method
    recursive_script.sql => Recursive Method
    sn_script.sql => Semi-Näive Method
    The ann_ prefix in the files names means that it's the script for the annotated algorithm.