forked from hapifhir/hapi-fhir
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eric Prud'hommeaux
committed
Jun 21, 2023
1 parent
49c3a18
commit 35dee35
Showing
4 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>ca.uhn.hapi.fhir</groupId> | ||
<artifactId>hapi-fhir</artifactId> | ||
<version>6.7.6-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>hapi-fhir-sparql</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>ca.uhn.hapi.fhir</groupId> | ||
<artifactId>hapi-fhir-base</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ca.uhn.hapi.fhir</groupId> | ||
<artifactId>hapi-fhir-structures-r4</artifactId> | ||
<version>6.7.6-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.fhir</groupId> | ||
<artifactId>ucum</artifactId> | ||
<!-- <exclusions>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>xpp3</groupId>--> | ||
<!-- <artifactId>xpp3</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>junit</groupId>--> | ||
<!-- <artifactId>junit</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- </exclusions>--> | ||
</dependency> | ||
<!-- <dependency>--> | ||
<!-- <groupId>ca.uhn.hapi.fhir</groupId>--> | ||
<!-- <artifactId>hapi-fhir-converter</artifactId>--> | ||
<!-- <version>${project.version}</version>--> | ||
<!-- </dependency>--> | ||
|
||
<dependency> | ||
<groupId>ca.uhn.hapi.fhir</groupId> | ||
<artifactId>hapi-fhir-caching-api</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ca.uhn.hapi.fhir</groupId> | ||
<artifactId>hapi-fhir-caching-caffeine</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ca.uhn.hapi.fhir</groupId> | ||
<artifactId>hapi-fhir-validation-resources-r4</artifactId> | ||
<version>${project.version}</version> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<!-- <dependency>--> | ||
<!-- <groupId>ca.uhn.hapi.fhir</groupId>--> | ||
<!-- <artifactId>org.hl7.fhir.validation</artifactId>--> | ||
<!-- <version>${fhir_core_version}</version>--> | ||
<!-- <exclusions>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>info.cqframework</groupId>--> | ||
<!-- <artifactId>elm</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>info.cqframework</groupId>--> | ||
<!-- <artifactId>cql-to-elm</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>info.cqframework</groupId>--> | ||
<!-- <artifactId>quick</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>info.cqframework</groupId>--> | ||
<!-- <artifactId>qdm</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>info.cqframework</groupId>--> | ||
<!-- <artifactId>cql</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>info.cqframework</groupId>--> | ||
<!-- <artifactId>model</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>io.javalin</groupId>--> | ||
<!-- <artifactId>javalin</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>junit</groupId>--> | ||
<!-- <artifactId>junit</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>org.apache.commons</groupId>--> | ||
<!-- <artifactId>commons-collections4</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- <exclusion>--> | ||
<!-- <groupId>xpp3</groupId>--> | ||
<!-- <artifactId>xpp3</artifactId>--> | ||
<!-- </exclusion>--> | ||
<!-- </exclusions>--> | ||
<!-- </dependency>--> | ||
</dependencies> | ||
</project> |
51 changes: 51 additions & 0 deletions
51
hapi-fhir-sparql/src/test/java/org/uu3/sparql/SparqlTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.uu3.sparql; | ||
|
||
import ca.uhn.fhir.context.FhirContext; | ||
import org.fhir.ucum.UcumException; | ||
import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext; | ||
import org.hl7.fhir.r4.model.Base; | ||
import org.hl7.fhir.r4.model.CodeableConcept; | ||
import org.hl7.fhir.r4.model.Coding; | ||
import org.hl7.fhir.r4.model.Observation; | ||
import org.hl7.fhir.r4.model.Quantity; | ||
import org.hl7.fhir.r4.utils.FHIRPathEngine; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
class SparqlTest { | ||
private static final FhirContext ourCtx = FhirContext.forR4Cached(); | ||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SparqlTest.class); | ||
private static FHIRPathEngine ourEngine; | ||
|
||
@Test | ||
public void testAs() { | ||
assertEquals(1, 1); | ||
} | ||
|
||
@Test | ||
public void testComponentCode() { | ||
String path = "(Observation.component.value.ofType(FHIR.Quantity)) "; | ||
|
||
Observation o1 = new Observation(); | ||
o1.addComponent() | ||
.setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code1"))) | ||
.setValue(new Quantity().setSystem("http://bar").setCode("code1").setValue(200)); | ||
o1.addComponent() | ||
.setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code2"))) | ||
.setValue(new Quantity().setSystem("http://bar").setCode("code2").setValue(200)); | ||
|
||
List<Base> outcome = ourCtx.newFhirPath().evaluate(o1, path, Base.class); | ||
assertEquals(2, outcome.size()); | ||
|
||
} | ||
|
||
@BeforeAll | ||
public static void beforeClass() { | ||
Exception ex = new UcumException(); | ||
ourEngine = new FHIRPathEngine(new HapiWorkerContext(ourCtx, ourCtx.getValidationSupport())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters