@jbr-experiment/ldbc-snb

中文文档
6.3.0发布于 2026/11/01MITTypeScriptCommonJS

LDBC Social Network Benchmark (Interactive and BI) experiment handler for JBR

原始使用文档
文档目录12 节
  1. Requirements
  2. Quick start
  3. 1. Install jbr
  4. 2. Initialize a new experiment
  5. 3. Configure the required hooks
  6. 4. Prepare the experiment
  7. 5. Run the experiment
  8. Output
  9. Queries
  10. Configuration
  11. Configuration fields
  12. License

JBR Experiment - LDBC SNB

Build status Coverage Status npm version

A jbr experiment type for the LDBC Social Network Benchmark (SNB) Interactive and Business Intelligence (BI) workloads, executed over a single (centralized) RDF dataset.

The dataset is generated in Turtle using the LDBC SNB Hadoop datagen, merged into a single N-Triples file, and queried using SPARQL versions of the Interactive short (IS1-7) and complex (IC1-14) queries, and/or the BI (v1, 2018) queries (BI1-24, except BI16), depending on the workload configuration field.

Requirements

  • Node.js (18 or higher)
  • Docker (required for invoking the LDBC SNB datagen)
  • jbr (required for initializing, preparing, and running experiments on the command line)

Quick start

1. Install jbr

jbr is a command line tool that enables experiments to be initialized, prepared, and started. It can be installed from the npm registry:

$ npm install -g jbr

or

$ yarn global add jbr

2. Initialize a new experiment

Using the jbr CLI tool, initialize a new experiment:

$ jbr init ldbc-snb my-experiment
$ cd my-experiment

This will create a new my-experiment directory with default configs for this experiment type.

3. Configure the required hooks

This experiment type requires you to configure a certain SPARQL endpoint to send queries to for the hookSparqlEndpoint. A value for this hook can be set as follows, such as sparql-endpoint-comunica:

$ jbr set-hook hookSparqlEndpoint sparql-endpoint-comunica

4. Prepare the experiment

In order to run all preprocessing steps, such as creating all required datasets, invoke the prepare step:

$ jbr prepare

This performs the following steps, where each step is skipped if its output already exists (unless jbr prepare -f is used):

  1. Run the LDBC SNB datagen for the configured scale factor, which produces Turtle files and substitution parameters in generated/out-snb/. This is also skipped if generated/out-snb/ was removed but all files derived from it (steps 2-4) for the configured workload exist, such as when using pre-generated assets.
  2. Merge all Turtle files into a single generated/dataset.nt file. Blank node labels of the datagen are globally unique, and are preserved.
  3. Create generated/parameters-persons.csv (persons from interactive_1_param.txt) and generated/parameters-messages.csv (a seeded random sample of posts and comments) for the short queries.
  4. Instantiate all Interactive query templates into generated/queries/ (if workload is interactive or all), and all BI query templates into generated/queries-bi/ (if workload is bi or all). The BI queries require the datagen's bi_N_param.txt files, so if generated/out-snb/ was removed, BI queries can only be added to existing pre-generated assets by regenerating them (jbr prepare -f).
  5. Optionally convert the dataset to HDT.

All prepared files will be contained in the generated/ directory:

generated/
  dataset.hdt                  # If generateHdt is enabled
  dataset.hdt.index.v1-1       # If generateHdt is enabled
  dataset.nt
  out-snb/
    social_network/
      social_network_activity_0_0.ttl
      social_network_person_0_0.ttl
      social_network_static_0_0.ttl
    substitution_parameters/
      bi_1_param.txt
      ...
      interactive_1_param.txt
      ...
  parameters-messages.csv
  parameters-persons.csv
  params.ini
  queries/                     # If workload is interactive or all
    interactive-complex-1.sparql
    ...
    interactive-short-7.sparql
  queries-bi/                  # If workload is bi or all
    bi-1.sparql
    ...
    bi-24.sparql

5. Run the experiment

Once the experiment has been fully configured and prepared, you can run it:

$ jbr run

Once the run step completes, results will be present in the output/ directory.

Output

The following output is generated after an experiment has run.

output/query-times.csv (one line per query instantiation, aggregated over the replication rounds):

name;id;error;errorDescription;failures;hash;httpRequests;httpRequestsMax;httpRequestsMin;httpRequestsStd;replication;results;resultsMax;resultsMin;time;timeMax;timeMin;times;timestamps;timestampsMax;timestampsMin;timestampsStd;timeStd;timestampsAll
interactive-short-4;0;false;;0;2e21f854f7ee6112613cc5912d141bdb;0;0;0;0;3;1;1;1;24.666666666666668;28;22;28 24 22;21.666666666666668;24;20;1.699673171197595;2.494438257849294;"[[20],[24],[21]]"
interactive-short-4;1;false;;0;29533521492a24c11be9676db0f16540;0;0;0;0;3;1;1;1;17.666666666666668;23;13;17 23 13;17.666666666666668;23;13;4.109609335312651;4.109609335312651;"[[17],[23],[13]]"

Next to this, output/query-results-raw.json contains the raw query results, and output/logs/ contains the datagen logs and load-time.csv, the time in milliseconds between starting the endpoint and starting the measured queries (this includes the warmup rounds).

Queries

The query templates in lib/templates/queries/ are based on the SPARQL queries of SolidBench, which in turn are based on the SNB Interactive SPARQL implementations, using the original http://www.ldbc.eu/ldbc_socialnet/1.0/ vocabulary emitted by the datagen.

Since SPARQL has no shortest path operator, interactive-complex-13 (single shortest path) only considers paths of at most 4 hops (returning -1 otherwise), and interactive-complex-14 (trusted connection paths) only considers shortest paths of at most 3 hops.

Short queries take a person or message IRI from the generated CSV files. Complex queries take their parameters from the datagen's interactive_N_param.txt files.

The BI query templates in lib/templates/queries-bi/ are based on the SNB BI SPARQL implementations, with the changes listed in their README. They take their parameters from the datagen's bi_N_param.txt files. bi-16 is excluded, since its variable-length path bounds cannot be expressed as a single template, and bi-25 is excluded since it is empty upstream.

All parameter selections are shuffled deterministically based on querySeed.

Configuration

The default generated configuration file (jbr-experiment.json) for this experiment looks as follows:

{
  "@context": [
    "https://linkedsoftwaredependencies.org/bundles/npm/jbr/^6.0.0/components/context.jsonld",
    "https://linkedsoftwaredependencies.org/bundles/npm/@jbr-experiment/ldbc-snb/^6.0.0/components/context.jsonld"
  ],
  "@id": "urn:jbr:my-experiment",
  "@type": "ExperimentLdbcSnb",
  "scale": "0.1",
  "hadoopMemory": "4G",
  "queryCount": 5,
  "querySeed": 12345,
  "workload": "interactive",
  "generateHdt": false,
  "endpointUrl": "http://localhost:3001/sparql",
  "endpointUrlExternal": "http://localhost:3001/",
  "queryRunnerReplication": 3,
  "queryRunnerWarmupRounds": 1,
  "queryRunnerRequestDelay": 0,
  "queryRunnerEndpointAvailabilityCheckTimeout": 1000,
  "queryRunnerUrlParams": {},
  "hookSparqlEndpoint": {
    "@id": "urn:jbr:my-experiment:hookSparqlEndpoint",
    "@type": "HookNonConfigured"
  }
}

Any config changes require re-running the prepare step.

Configuration fields

  • scale: The SNB scale factor, such as 0.1, 0.3, 1, 3, 10, ... Defaults to 0.1.
  • hadoopMemory: The maximum heap size of the Hadoop datagen, such as 4G. Higher scale factors require more memory.
  • queryCount: Number of instantiations per query template. For the Interactive workload, this can not exceed the number of rows in the datagen's substitution parameter files. For the BI workload, parameter rows are repeated if a file has fewer rows (such as bi_20_param.txt, which always has 3 rows).
  • querySeed: Random seed for selecting query parameters.
  • workload: The workload to prepare and run: interactive (queries in generated/queries/), bi (queries in generated/queries-bi/), or all (both). Defaults to interactive.
  • generateHdt: If a dataset.hdt should also be generated.
  • endpointUrl: URL through which the SPARQL endpoint of the hookSparqlEndpoint hook will be exposed.
  • endpointUrlExternal: URL through which the SPARQL endpoint of the hookSparqlEndpoint hook will be exposed. This will be used for waiting until the endpoint is available.
  • queryRunnerReplication: Number of replication runs for sparql-benchmark-runner.
  • queryRunnerWarmupRounds: Number of warmup runs for sparql-benchmark-runner.
  • queryRunnerRequestDelay: Delay between requests in milliseconds for sparql-benchmark-runner.
  • queryRunnerEndpointAvailabilityCheckTimeout: Timeout in milliseconds for checking if the SPARQL endpoint is available.
  • queryRunnerUrlParams: A JSON record of string mappings containing URL parameters that will be passed to the SPARQL endpoint.
  • queryTimeoutFallback: An optional timeout value for a single query in milliseconds, to be used as fallback in case the SPARQL endpoint hook's timeout fails. This should always be higher than the timeout value configured in the SPARQL endpoint hook.

License

jbr.js is written by Ruben Taelman.

This code is copyrighted by Ghent University – imec and released under the MIT license.

版本与发布记录

@jbr-experiment/ldbc-snb 共发布 4 个版本,首次发布于 2026/09/25;过去 12 个月发布了 4 个版本。

版本发布日期距今
6.3.0latest2026/11/012 天前
6.2.22026/10/276 天前
6.2.12026/09/251 个月前
6.2.02026/09/251 个月前

关于 @jbr-experiment/ldbc-snb 的常见问题

@jbr-experiment/ldbc-snb 是什么?

用于JBR的LDBC社交网络基准(交互和BI)实验处理程序

如何安装 @jbr-experiment/ldbc-snb?

在项目目录运行 npm install @jbr-experiment/ldbc-snb,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:jbr(>=2.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@jbr-experiment/ldbc-snb 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@jbr-experiment/ldbc-snb 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@jbr-experiment/ldbc-snb 可以商用吗?

@jbr-experiment/ldbc-snb 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@jbr-experiment/ldbc-snb 还在维护吗?

最新版本 6.3.0 发布于 2026/11/01(2 天前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/09/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。