-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
a68ac18
commit d219f33
Showing
11 changed files
with
712 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,23 @@ | ||
name: Build & Test with Bun | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 # Checkout repo | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v1 # Setup bun | ||
with: | ||
bun-version: latest | ||
|
||
- run: bun i # Install dependencies | ||
- run: npm run build # Build sources | ||
- run: npm run test # Run tests |
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,177 @@ | ||
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore | ||
|
||
# Logs | ||
|
||
logs | ||
_.log | ||
npm-debug.log_ | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
.pnpm-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
|
||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json | ||
|
||
# Runtime data | ||
|
||
pids | ||
_.pid | ||
_.seed | ||
\*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
|
||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
|
||
coverage | ||
\*.lcov | ||
|
||
# nyc test coverage | ||
|
||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
|
||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
|
||
bower_components | ||
|
||
# node-waf configuration | ||
|
||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
|
||
build/Release | ||
|
||
# Dependency directories | ||
|
||
node_modules/ | ||
jspm_packages/ | ||
lib | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
|
||
web_modules/ | ||
|
||
# TypeScript cache | ||
|
||
\*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
|
||
.npm | ||
|
||
# Optional eslint cache | ||
|
||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
|
||
.stylelintcache | ||
|
||
# Microbundle cache | ||
|
||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
|
||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
|
||
\*.tgz | ||
|
||
# Yarn Integrity file | ||
|
||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
|
||
.env | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.env.local | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
|
||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
|
||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
|
||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
|
||
.cache/ | ||
|
||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
|
||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
|
||
# public | ||
|
||
# vuepress build output | ||
|
||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
|
||
.temp | ||
.cache | ||
|
||
# Docusaurus cache and generated files | ||
|
||
.docusaurus | ||
|
||
# Serverless directories | ||
|
||
.serverless/ | ||
|
||
# FuseBox cache | ||
|
||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
|
||
.dynamodb/ | ||
|
||
# TernJS port file | ||
|
||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
|
||
.vscode-test | ||
|
||
# yarn v2 | ||
|
||
.yarn/cache | ||
.yarn/unplugged | ||
.yarn/build-state.yml | ||
.yarn/install-state.gz | ||
.pnp.\* | ||
|
||
# IntelliJ based IDEs | ||
.idea | ||
|
||
# Finder (MacOS) folder config | ||
.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 |
---|---|---|
@@ -1,2 +1,29 @@ | ||
# xml-utils-processors-ts | ||
Typescript wrapper over the Saxon-HE library to be used within the Connector Architecture | ||
|
||
[![Bun CI](https://github.com/julianrojas87/xml-utils-processors-ts/actions/workflows/build-test.yml/badge.svg)](https://github.com/julianrojas87/xml-utils-processors-ts/actions/workflows/build-test.yml) [![npm](https://img.shields.io/npm/v/xml-utils-processors-ts.svg?style=popout)](https://npmjs.com/package/xml-utils-processors-ts) | ||
|
||
Typescript wrapper over the Saxon-HE library to be used within the [Connector Architecture](https://the-connector-architecture.github.io/site/docs/1_Home). Currently this repository exposes 1 function: | ||
|
||
### [`js:XQueryProcessor`](https://github.com/julianrojas87/xml-utils-processors-ts/blob/main/processors.ttl#L9) | ||
|
||
This processor is able to execute one or multiple predefined XQueries over as stream of XML documents. It relies on the Java-based [Saxon-HE engine](https://github.com/Saxonica/Saxon-HE/) to execute the XQueries. This processor can be used within a Connector Architecture (CA) pipeline, by defining an input stream of XML documents (`js:xmlInput`), over which a set of XQueries (`js:xquery`) will be executed and output in a set of correspondent output streams (`js:output`). Each query shall be given a name which must correspond to the name of the output stream where the result will be expected. An example definition of the processor is shown next: | ||
|
||
```turtle | ||
[ ] a js:XQueryProcessor; | ||
js:xmlInput <xmlChannelReader>; | ||
js:xquery [ | ||
js:name "Q1"; | ||
js:query "<SomeXQuery>{}</SomeXQuery>" | ||
], [ | ||
js:name "Q2"; | ||
js:query "<AnotherXQuery>{}</AnotherXQuery>" | ||
]; | ||
js:output [ | ||
js:name "Q1"; | ||
js:outputStream <outputChannelReader1> # This can be consumed by another CA processor | ||
], [ | ||
js:name "Q2"; | ||
js:outputStream <outputChannelReader2> # This can be consumed by another CA processor | ||
]; | ||
js:saxonLocation <./SaxonHE12-3J.zip>. # Optional. If not given the latest release will be used | ||
``` |
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,37 @@ | ||
{ | ||
"name": "xml-utils-processors-ts", | ||
"version": "0.1.0", | ||
"type": "module", | ||
"author": "Julián Rojas", | ||
"scripts": { | ||
"build": "tsc", | ||
"prepublish": "tsc", | ||
"test": "bun test --timeout 15000", | ||
"watch": "tsc -w" | ||
}, | ||
"files": [ | ||
"lib/**/*", | ||
"./processors.ttl" | ||
], | ||
"license": "MIT", | ||
"keywords": [ | ||
"XML", | ||
"XQuery", | ||
"Saxon", | ||
"Connector Architecture" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/julianrojas87/xml-utils-processors-ts.git" | ||
}, | ||
"dependencies": { | ||
"adm-zip": "^0.5.10" | ||
}, | ||
"devDependencies": { | ||
"@ajuvercr/js-runner": "^0.1.12", | ||
"@jest/globals": "^29.7.0", | ||
"@types/adm-zip": "^0.5.3", | ||
"del": "^7.1.0", | ||
"typescript": "^5.2.2" | ||
} | ||
} |
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,91 @@ | ||
@prefix js: <https://w3id.org/conn/js#>. | ||
@prefix fno: <https://w3id.org/function/ontology#>. | ||
@prefix fnom: <https://w3id.org/function/vocabulary/mapping#>. | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>. | ||
@prefix : <https://w3id.org/conn#>. | ||
@prefix sh: <http://www.w3.org/ns/shacl#>. | ||
@prefix dc: <http://purl.org/dc/terms/>. | ||
|
||
js:XQueryProcessor a js:JsProcess; | ||
js:file <./lib/XMLUtils.js>; | ||
js:function "doXQuery"; | ||
js:location <./>; | ||
js:mapping [ | ||
a fno:Mapping; | ||
fno:parameterMapping [ | ||
a fnom:PositionParameterMapping; | ||
fnom:functionParameter "xmlInput"; | ||
fnom:implementationParameterPosition "0"^^xsd:integer; | ||
], [ | ||
a fnom:PositionParameterMapping; | ||
fnom:functionParameter "xqueries"; | ||
fnom:implementationParameterPosition "1"^^xsd:integer; | ||
], [ | ||
a fnom:PositionParameterMapping; | ||
fnom:functionParameter "outputs"; | ||
fnom:implementationParameterPosition "2"^^xsd:integer; | ||
], [ | ||
a fnom:PositionParameterMapping; | ||
fnom:functionParameter "saxonLocation"; | ||
fnom:implementationParameterPosition "3"^^xsd:integer; | ||
]; | ||
]. | ||
|
||
[ ] a sh:NodeShape; | ||
sh:targetClass js:XQueryProcessor; | ||
sh:property [ | ||
sh:path js:xmlInput; | ||
sh:name "xmlInput"; | ||
sh:class :ReaderChannel; | ||
sh:minCount 1; | ||
sh:maxCount 1; | ||
], [ | ||
sh:path js:xquery; | ||
sh:name "xqueries"; | ||
sh:class js:XQuery; | ||
sh:minCount 1; | ||
], [ | ||
sh:path js:output; | ||
sh:name "outputs"; | ||
sh:class js:XQueryOutput; | ||
sh:minCount 1; | ||
], [ | ||
sh:path js:saxonLocation; | ||
sh:name "saxonLocation"; | ||
sh:datatype xsd:string; | ||
sh:minCount 0; | ||
sh:maxCount 1; | ||
]. | ||
|
||
[ ] a sh:NodeShape; | ||
sh:targetClass js:XQuery; | ||
sh:property [ | ||
sh:path js:name; | ||
sh:datatype xsd:string; | ||
sh:name "name"; | ||
sh:maxCount 1; | ||
sh:minCount 1; | ||
], [ | ||
sh:path js:query; | ||
sh:datatype xsd:string; | ||
sh:name "query"; | ||
sh:maxCount 1; | ||
sh:minCount 1; | ||
]. | ||
|
||
[ ] a sh:NodeShape; | ||
sh:targetClass js:XQueryOutput; | ||
sh:property [ | ||
sh:path js:name; | ||
sh:datatype xsd:string; | ||
sh:name "name"; | ||
sh:maxCount 1; | ||
sh:minCount 1; | ||
], [ | ||
sh:path js:outputStream; | ||
sh:class :WriterChannel; | ||
sh:name "stream"; | ||
sh:maxCount 1; | ||
sh:minCount 1; | ||
]. | ||
|
Oops, something went wrong.