Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/

package com.marklogic.client.expression;
Expand Down Expand Up @@ -2043,6 +2043,36 @@ public interface ModifyPlan extends PreparePlan, PlanBuilderBase.ModifyPlanBase
* @since 7.2.0; requires MarkLogic 12
*/
public abstract ModifyPlan shortestPath(PlanExprCol start, PlanExprCol end, PlanExprCol path, PlanExprCol length, PlanExprCol weight);
/**
* This method performs a transitive closure operation over a graph-like structure, identifying all reachable node pairs from a given start node to an end node through one or more intermediate steps. A set of (start, end) node pairs where a path exists between them with a length between minLength and maxLength, inclusive. This models the SPARQL one-or-more (+) operator, enabling recursive or chained relationships to be queried efficiently.
* @param start The column is the starting node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @param end The column is the end node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @return a ModifyPlan object
*/
public abstract ModifyPlan transitiveClosure(String start, String end);
/**
* This method performs a transitive closure operation over a graph-like structure, identifying all reachable node pairs from a given start node to an end node through one or more intermediate steps. A set of (start, end) node pairs where a path exists between them with a length between minLength and maxLength, inclusive. This models the SPARQL one-or-more (+) operator, enabling recursive or chained relationships to be queried efficiently.
* @param start The column is the starting node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @param end The column is the end node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @return a ModifyPlan object
*/
public abstract ModifyPlan transitiveClosure(PlanExprCol start, PlanExprCol end);
/**
* This method performs a transitive closure operation over a graph-like structure, identifying all reachable node pairs from a given start node to an end node through one or more intermediate steps. A set of (start, end) node pairs where a path exists between them with a length between minLength and maxLength, inclusive. This models the SPARQL one-or-more (+) operator, enabling recursive or chained relationships to be queried efficiently.
* @param start The column is the starting node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @param end The column is the end node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @param options This is either an array of strings or an object containing keys and values for the options to this operator. Options include: min-length This option is the minimum number of steps (edges) required in the path. It should be a non-negative integer, and the default is 1.max-length This option Maximum number of steps (edges) allowed in the path. It should be a non-negative integer, and the default is unlimited.
* @return a ModifyPlan object
*/
public abstract ModifyPlan transitiveClosure(String start, String end, PlanTransitiveClosureOptions options);
/**
* This method performs a transitive closure operation over a graph-like structure, identifying all reachable node pairs from a given start node to an end node through one or more intermediate steps. A set of (start, end) node pairs where a path exists between them with a length between minLength and maxLength, inclusive. This models the SPARQL one-or-more (+) operator, enabling recursive or chained relationships to be queried efficiently.
* @param start The column is the starting node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @param end The column is the end node of the traversal. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. See {@link PlanBuilder#col(XsStringVal)}
* @param options This is either an array of strings or an object containing keys and values for the options to this operator. Options include: min-length This option is the minimum number of steps (edges) required in the path. It should be a non-negative integer, and the default is 1.max-length This option Maximum number of steps (edges) allowed in the path. It should be a non-negative integer, and the default is unlimited.
* @return a ModifyPlan object
*/
public abstract ModifyPlan transitiveClosure(PlanExprCol start, PlanExprCol end, PlanTransitiveClosureOptions options);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
package com.marklogic.client.expression;

Expand Down Expand Up @@ -356,6 +356,15 @@ public interface PlanBuilderBase {
*/
PlanSparqlOptions sparqlOptions();

/**
* Provides a transitive closure option object to configure the execution of the
* {@link PlanBuilder.ModifyPlan#transitiveClosure(PlanExprCol, PlanExprCol, PlanTransitiveClosureOptions)}
* operator. Use the fluent methods of the transitive closure option object
* to set the configuration.
* @return the configuration object
*/
PlanTransitiveClosureOptions transitiveClosureOptions();

/**
* Specifies a JavaScript or XQuery function installed on the server for use
* in post-processing in a map() or reduce() operation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/

package com.marklogic.client.impl;
Expand Down Expand Up @@ -2268,6 +2268,42 @@ public ModifyPlan shortestPath(PlanExprCol start, PlanExprCol end, PlanExprCol p
}


@Override
public ModifyPlan transitiveClosure(String start, String end) {
return transitiveClosure((start == null) ? (PlanExprCol) null : exprCol(start), (end == null) ? null : exprCol(end));
}


@Override
public ModifyPlan transitiveClosure(PlanExprCol start, PlanExprCol end) {
if (start == null) {
throw new IllegalArgumentException("start parameter for transitiveClosure() cannot be null");
}
if (end == null) {
throw new IllegalArgumentException("end parameter for transitiveClosure() cannot be null");
}
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "transitive-closure", new Object[]{ start, end });
}


@Override
public ModifyPlan transitiveClosure(String start, String end, PlanTransitiveClosureOptions options) {
return transitiveClosure((start == null) ? null : exprCol(start), (end == null) ? null : exprCol(end), options);
}


@Override
public ModifyPlan transitiveClosure(PlanExprCol start, PlanExprCol end, PlanTransitiveClosureOptions options) {
if (start == null) {
throw new IllegalArgumentException("start parameter for transitiveClosure() cannot be null");
}
if (end == null) {
throw new IllegalArgumentException("end parameter for transitiveClosure() cannot be null");
}
return new PlanBuilderSubImpl.ModifyPlanSubImpl(this, "op", "transitive-closure", new Object[]{ start, end, PlanBuilderSubImpl.asArg(PlanBuilderSubImpl.makeMap(options)) });
}


@Override
public ModifyPlan union(ModifyPlan right) {
if (right == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
package com.marklogic.client.impl;

Expand Down Expand Up @@ -487,6 +487,10 @@ public PlanSampleByOptions withLimit(XsIntVal limit) {
public PlanSparqlOptions sparqlOptions() {
return new PlanSparqlOptionsImpl(this);
}
@Override
public PlanTransitiveClosureOptions transitiveClosureOptions() {
return new PlanTransitiveClosureOptionsImpl(this);
}
static class PlanSparqlOptionsImpl implements PlanSparqlOptions {
private PlanBuilderBaseImpl pb;
private XsBooleanVal deduplicate;
Expand Down Expand Up @@ -526,6 +530,45 @@ public PlanSparqlOptions withDeduplicated(XsBooleanVal deduplicate) {
}
}

static class PlanTransitiveClosureOptionsImpl implements PlanTransitiveClosureOptions {
private PlanBuilderBaseImpl pb;
private XsLongVal minLength;
private XsLongVal maxLength;
PlanTransitiveClosureOptionsImpl(PlanBuilderBaseImpl pb) {
this.pb = pb;
}
PlanTransitiveClosureOptionsImpl(PlanBuilderBaseImpl pb, XsLongVal minLength, XsLongVal maxLength) {
this(pb);
this.minLength = minLength;
this.maxLength = maxLength;
}

@Override
public XsLongVal getMinLength() {
return minLength;
}
@Override
public PlanTransitiveClosureOptions withMinLength(long minLength) {
return withMinLength(pb.xs.longVal(minLength));
}
@Override
public PlanTransitiveClosureOptions withMinLength(XsLongVal minLength) {
return new PlanTransitiveClosureOptionsImpl(this.pb, minLength, this.maxLength);
}
@Override
public XsLongVal getMaxLength() {
return maxLength;
}
@Override
public PlanTransitiveClosureOptions withMaxLength(long maxLength) {
return withMaxLength(pb.xs.longVal(maxLength));
}
@Override
public PlanTransitiveClosureOptions withMaxLength(XsLongVal maxLength) {
return new PlanTransitiveClosureOptionsImpl(this.pb, this.minLength, maxLength);
}
}

@Override
public ServerExpression caseExpr(PlanCase... cases) {
int lastPos = cases.length - 1;
Expand Down Expand Up @@ -744,6 +787,29 @@ static Map<String,String> makeMap(PlanSparqlOptions options) {

return mapdef;
}
static Map<String,Object> makeMap(PlanTransitiveClosureOptions options) {
if (options == null) {
return null;
}

Map<String,Object> mapdef = null;

XsLongVal minLength = options.getMinLength();
if (minLength != null) {
mapdef = new HashMap<>();
mapdef.put("minLength", minLength.getLong());
}

XsLongVal maxLength = options.getMaxLength();
if (maxLength != null) {
if (mapdef == null) {
mapdef = new HashMap<>();
}
mapdef.put("maxLength", maxLength.getLong());
}

return mapdef;
}
static Map<String,String> makeMap(String key, String value) {
Map<String, String> map = new HashMap<String, String>();
if (key != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2010-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
*/
package com.marklogic.client.type;

// IMPORTANT: Do not edit. This file is generated.

/**
* Options for controlling transitive closure operations, including minimum and maximum
* path lengths.
*/
public interface PlanTransitiveClosureOptions {
XsLongVal getMinLength();
PlanTransitiveClosureOptions withMinLength(long minLength);
PlanTransitiveClosureOptions withMinLength(XsLongVal minLength);
XsLongVal getMaxLength();
PlanTransitiveClosureOptions withMaxLength(long maxLength);
PlanTransitiveClosureOptions withMaxLength(XsLongVal maxLength);
}
Loading