Skip to main content

Using MarkLogic Content Pump (mlcp)

Graph Selection When Loading Quads

When loading quads, you can use the following command line options to control the graph into which your quads are loaded:

  • -output_graph

  • -output_override_graph

  • -output_collections

You can use -output_collections by itself or with the other two options. You cannot use -output_graph and -output_override_graph together.

If your semantic data is not in a quad format like N-Quads, see Graph Selection for Other Triple Types.

Quads interact with these options differently than other triple formats because quads can include a graph IRI in each quad. The following table summarizes the effect of various option combinations when importing quads with mlcp:

Graph Options

Description

none

For quads that contain an explicit graph IRI, load the triple into that graph. For quads with no explicit graph IRI, load the triple into the default graph. The default graph URI is http://marklogic.com/semantics#default-graph.

-output_graph

For quads that contain an explicit graph IRI, load the triple into that graph. For quads with no explicit graph IRI, load the triple into the graph specified by -output_graph.

-output_override_graph

Load all triples into the graph specified by -output_override_graph. This graph overrides any graph IRIs contained in the quads.

-output_collections

Similar to -output_override_graph, but you can specifiy multiple collections. Load triples into the graph specified as the first (or only) collection; also add triples to any additional collections on the list. This overrides any graph IRIs contained in the quads.

-output_graph with -output_collections

For quads that contain an explicit graph IRI, load the triple into that graph. For quads with no explicit graph IRI, load the triple into the graph specified by -output_graph. Also add triples to the specified collections.

-output_override_graph with -output_collection

Load all triples into the graph specified by -output_override_graph. This graph overrides any graph IRIs contained in the quads. Also add triples to the specified collections.

For more details, see Loading Triples with mlcp in the Semantic Graph Developer’s Guide.

For example, suppose you load the following N-Quad data with mlcp. There are 3 quads in the data set. The first and last quad include a graph IRI, the second quad does not.

<http://one.example/subject1> <http://one.example/predicate1>
    <http://one.example/object1> <http://example.org/graph3> .
_:subject1 <http://an.example/predicate1> "object1"  .
_:subject2 <http://an.example/predicate2> "object2"
    <http://example.org/graph5> .

If you use a command similar to the following load the data:

# Windows users, see Modifying the Example Commands for Windows
$ mlcp.sh import -username user -password password -host localhost \
    -port 8000 -input_file_path /my/data.nq -mode local \
    -input_file_type rdf 

Then the table below illustrates how the various graph related options affect how the triples are loaded into the database:

Graph Options

Result

none

Graphs:

http://example.org/graph3  

http://marklogic.com/semantics#default-graph

http://example.org/graph5

-output_graph /my/graph

Graphs:

http://example.org/graph3 

/my/graph

http://example.org/graph5

-output_override_graph /my/graph

Graphs: /my/graph for all triples

-output_collections "aa,bb,cc"

Graphs: aa for all triples. All triples also added to collections bb and cc

-output_graph /my/graph -output_collections "bb,cc"

Graphs:

http://example.org/graph3  

/my/graph 

http://example.org/graph5

All triples also added to collections bb and cc

-output_override_graph /my/graph -output_collections "bb,cc"

Graphs: /my/graph for all triples. All triples also added to collections bb and cc