Previous topic

Querying RDF with SPARQL

This Page

RDFCloseΒΆ

The shell script rdfclose and the accompanying jar file rdfclose.jar have been developed as an addition to the Jena command-line tools. You can place them in any convenient directory in your file space, but they do need to be in the same directory as each other.

After downloading rdfclose and saving it somewhere convenient, make sure that the file is executable:

dice:~> chmod 755 rdfclose

The usage of rdfclose is as follows:

rdfclose --data=<dataset> --schema=<schema> --input=<format> --output=<format>
         --data                  You must indicate at least one dataset.
         --schema                You must indicate at least one schema file.
         --input                 You must indicate the format of the dataset and the schema file.
                                 (Predefined values for this form at are
                                 "RDF/XML", "N-TRIPLE", "TURTLE" (or "TTL") and
                                 "N3". null represents the default language, "RDF/XML". "RDF/XML-ABBREV" is a synonym for "RDF/XML". )
         --output                The output format is N3 by default but you can still choose your favorite.

As an example, let’s suppose that you have the files cafes.n3 and cafeSchema.n3 in the same directory as rdfclose and rdfclose.jar. To derive RDFS entailments from these two files, you execute the following command:

dice:~> ./rdfclose --data=cafes.n3 --schema=cafeSchema.n3 --input=N3

This will produce a lot of output in your terminal window. To save the output, say in a file called cafeClosure.n3, use the following instead:

dice:~> ./rdfclose --data=cafes.n3 --schema=cafeSchema.n3 --input=N3 > cafeClosure.n3

This new file cafeClosure.n3 will contain all the triples that are asserted in cafes.n3 and cafeSchema.n3, plus all the inferred triples produced by RDFS-entailment.