![JAR search and dependency download from the Maven repository](/logo.png)
au.csiro.pathling.fhirpath.element.ReferencePath Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fhirpath Show documentation
Show all versions of fhirpath Show documentation
A library that can translate FHIRPath expressions into Spark queries.
The newest version!
/*
* Copyright 2023 Commonwealth Scientific and Industrial Research
* Organisation (CSIRO) ABN 41 687 119 230.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package au.csiro.pathling.fhirpath.element;
import au.csiro.pathling.fhirpath.Referrer;
import au.csiro.pathling.fhirpath.ResourcePath;
import jakarta.annotation.Nonnull;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import org.apache.spark.sql.Column;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.hl7.fhir.r4.model.Enumerations.FHIRDefinedType;
import org.hl7.fhir.r4.model.Enumerations.ResourceType;
/**
* Represents a FHIRPath expression which is a resource reference.
*
* @author John Grimes
*/
public class ReferencePath extends ElementPath implements Referrer {
protected ReferencePath(@Nonnull final String expression, @Nonnull final Dataset dataset,
@Nonnull final Column idColumn, @Nonnull final Optional eidColumn,
@Nonnull final Column valueColumn, final boolean singular,
@Nonnull final Optional currentResource,
@Nonnull final Optional thisColumn, @Nonnull final FHIRDefinedType fhirType) {
super(expression, dataset, idColumn, eidColumn, valueColumn, singular, currentResource,
thisColumn, fhirType);
}
@Nonnull
public Set getResourceTypes() {
if (getDefinition().isPresent()) {
return getDefinition().get().getReferenceTypes();
} else {
return Collections.emptySet();
}
}
@Nonnull
public Column getReferenceColumn() {
return Referrer.referenceColumnFor(this);
}
@Nonnull
public Column getResourceEquality(@Nonnull final ResourcePath resourcePath) {
return Referrer.resourceEqualityFor(this, resourcePath);
}
@Nonnull
public Column getResourceEquality(@Nonnull final Column targetId,
@Nonnull final Column targetCode) {
return Referrer.resourceEqualityFor(this, targetCode, targetId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy