Last modified 2 years ago Last modified on 01/08/13 09:52:42
Note: this command, and any other commands that connect to the backend will not work if the HTTP server (4s-httpd) is connected to the backend, see SparqlServer for alternative ways to import data over HTTP.

The most basic import command specifies only the name of the database to which RDF data is being imported and the name of the file to import.

4s-import demo icecreams.rdf


4store's import command produces no output by default unless something goes wrong. If you'd like more verbose feedback on how the import is progressing, or just some reassurance that it's doing something at all, try

4s-import -v demo icecream.rdf

Multiple files

It is faster to import several files at the same time with a single command. This amortises the database connection setup time over all the imports, for small files it's a significant difference.

4s-import demo starters.rdf mains.rdf desserts.rdf

RDF formats

There are many RDF formats. The import parser will try to guess which format your file is in if you don't specify. If you need to override the guess, or if you're certain you know the format for all the files being imported you can specify it with the --format flag.

4s-import demo --format ntriples starters mains desserts

Model URIs

4store's model URIs map to SPARQL graphs. If you import data from a format such as TriG with explicitly named graphs this is handled for you. Otherwise you may need to specify which model the imported data is for.

By default the name of your imported model (SPARQL graph) in 4store will be a file: URI derived from the import filename. You can use the --model flag to override this with any other URI.

4s-import demo --model schema.rdf --model data.ttl

Adding data

Ordinarily importing RDF to a model replaces any previous contents of that model, by using the --add flag this behaviour is overridden and any triples which were previously in the model are retained.

4s-import demo --add --model http:/ moredata.ttl