Skip to content

Commit

Permalink
homework
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed May 16, 2023
1 parent 891c45e commit 98bf14b
Show file tree
Hide file tree
Showing 24 changed files with 10,947 additions and 96 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Long mathematical formulas, especially multi-row ones such as `$$\matrix(...)$$`

This additional syntax is resolved with the Node.js module [`lib/number.js`](lib/number.js).

Run `npm start` to start a Node.js server and access the HTML pages at, for example, `http://localhost/odata-aggr`.
Run `npm start` to start a Node.js server and access the HTML pages at, for example, `http://localhost/odata-data-aggregation-ext`.

## To Do

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

This repository contains working drafts for OData specifications:

* [OData Extension for Data Aggregation Working Draft for CS03](odata-aggr)
* [OData Extension for Data Aggregation Working Draft for CS03](odata-data-aggregation-ext)
File renamed without changes.
File renamed without changes.
6,355 changes: 6,355 additions & 0 deletions docs/odata-data-aggregation-ext/odata-data-aggregation-ext.html

Large diffs are not rendered by default.

4,462 changes: 4,462 additions & 0 deletions docs/odata-data-aggregation-ext/odata-data-aggregation-ext.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ img {
width: 100%;
}

.toc li {
list-style-type: none;
}

.example,
.example table {
font-size: smaller;
Expand Down
4 changes: 2 additions & 2 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const {PassThrough} = require("stream");
for (var doc of fs.readdirSync(__dirname + "/..", {withFileTypes: true}))
if (doc.isDirectory() && doc.name.startsWith("odata-")) {
console.log(doc.name);
var md = fs.createWriteStream(__dirname + "/../docs/" + doc.name + "/README.md");
var md = fs.createWriteStream(__dirname + "/../docs/" + doc.name + "/" + doc.name + ".md");
var html = pandoc({
"--metadata-file": __dirname + "/../" + doc.name + "/meta.yaml"
}, fs.createWriteStream(__dirname + "/../docs/" + doc.name + "/index.html")).stdin;
}, fs.createWriteStream(__dirname + "/../docs/" + doc.name + "/" + doc.name + ".html")).stdin;
new Number(doc.name).build(new PassThrough()
.on("data", function(chunk) {
md.write(chunk);
Expand Down
33 changes: 29 additions & 4 deletions lib/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,30 @@ class Number {
.on("line", function(line) {
var m = line.match(/ ##([A-Za-z]+)(_([A-Za-z]+))?/);
if (m && line[m.index + m[0].length] !== "]") {
if (m[1].endsWith("sec") && !m[2]) {
if (m[1].endsWith("sec")) {
m = line.match(/ ##([a-z]+)\s+(.+)$/);
m[3] = m[2].replace(/[^A-Za-z]/g, "");
}
this.counter[m[1]] = (this.counter[m[1]] || 0) + 1;
for (var subc in this.counter)
if (subc.endsWith("sub" + m[1]))
this.counter[subc] = 0;
this.number[this.match] = this.counter[m[1]];
this.number[this.match] = String(this.counter[m[1]]);
for (var supc = m[1]; supc.startsWith("sub");)
this.number[this.match] = this.counter[supc = supc.substring(3)] + "." + this.number[this.match];
if (m[1].endsWith("sec")) {
var s = this.number[this.match];
this.toc[s] = {
number: s,
name: m[2],
href: m[3],
sub: []
};
this.toc[s.substring(0, s.lastIndexOf("."))].sub.push(this.toc[s]);
}
if (m[2]) {
this.refs[m[3]] = this.number[this.match];
this.number[this.match] = `<a name="${m[3]}">${this.number[this.match]}</a>`;
this.number[this.match] = `<a name="${m[3]}" href="#${m[3]}">${this.number[this.match]}</a>`;
}
this.match++;
}
Expand All @@ -53,14 +63,29 @@ class Number {
}.bind(this));
}

tableofcontents(t, out, indent) {
for (var s of t) {
out.write(`${indent}- [${s.number}](#${s.href}) ${s.name}\n`);
this.tableofcontents(s.sub, out, indent + " ");
}
}

async build(out) {
this.counter = {};
this.refs = {};
this.number = {};
this.toc = {"": {sub: []}};
this.match = 0;
for (var c of this.chapters) await this.phase1(c);
this.match = 0;
for (c of this.chapters) await this.phase2(c, out);
for (c of this.chapters) {
await this.phase2(c, out);
if (c[0] === "0") {
out.write("# Table of Contents\n\n::: toc\n");
this.tableofcontents(this.toc[""].sub, out, "");
out.write(":::\n\n");
}
}
out.end();
}
}
Expand Down
26 changes: 16 additions & 10 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@ const fs = require("fs");
const http = require("http");

var app = express()
.get("/:doc/", function(req, res, next) {
try {
var number = new Number(__dirname + "/../" + req.params.doc);
res.type("html");
number.build(pandoc({
"--metadata-file": __dirname + "/../" + req.params.doc + "/meta.yaml",
...req.query
}, res).stdin);
} catch (err) {
next();
.get("/:doc", function(req, res, next) {
if (req.path.endsWith("/"))
try {
var number = new Number(__dirname + "/../" + req.params.doc);
res.type("html");
number.build(pandoc({
"--metadata-file": __dirname + "/../" + req.params.doc + "/meta.yaml",
...req.query
}, res).stdin);
} catch (err) {
next();
}
else {
var url = new URL("s://" + req.url);
url.pathname += "/";
res.redirect(url.href.substring(5));
}
})
.use(express.static(__dirname + "/../docs"));
Expand Down
77 changes: 77 additions & 0 deletions odata-data-aggregation-ext/0 frontmatter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
## Committee Specification Draft 04

## 28 October 2022

**This stage:**
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.md (Authoritative)
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.html
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.pdf

**Previous stage:**
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/odata-data-aggregation-ext-v4.0-cs02.docx (Authoritative)
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/odata-data-aggregation-ext-v4.0-cs02.html
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/odata-data-aggregation-ext-v4.0-cs02.pdf

**Latest stage:**
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.md (Authoritative)
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.html
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.pdf

**Technical Committee:**
[OASIS Open Data Protocol (OData) TC](https://www.oasis-open.org/committees/odata/)

**Chairs:**
Ralf Handl ([email protected]), [SAP SE](https://www.sap.com)
Michael Pizzo ([email protected]), [Microsoft](https://www.microsoft.com)

**Editors:**
Ralf Handl ([email protected]), [SAP SE](https://www.sap.com)
Hubert Heijkers ([email protected]), [IBM](https://www.ibm.com)
Michael Pizzo ([email protected]), [Microsoft](https://www.microsoft.com)
Gerald Krause ([email protected]), [SAP SE](https://www.sap.com)
Heiko Theißen ([email protected]), [SAP SE](https://www.sap.com)
Martin Zurmuehl ([email protected]), [SAP SE](https://www.sap.com)

<a name="AdditionalArtifacts">**Additional artifacts:**</a>
This document is one component of a Work Product that also includes:
- OData Aggregation ABNF Construction Rules Version 4.0: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/abnf/odata-aggregation-abnf.txt
- OData Aggregation ABNF Test Cases: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/abnf/odata-aggregation-testcases.xml
- OData Core Vocabulary: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/vocabularies/Org.OData.Core.V1.xml
- OData Aggregation Vocabulary: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/vocabularies/Org.OData.Aggregation.V1.xml

<a name="RelatedWork">**Related work:**</a>
This document is related to:
- OData Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. A multi-part Work Product which includes:
- OData Version 4.01. Part 1: Protocol. Latest stage: https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html.
- OData Version 4.01. Part 2: URL Conventions. Latest stage: https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html.
- ABNF components: OData ABNF Construction Rules Version 4.01 and OData ABNF Test Cases. https://docs.oasis-open.org/odata/odata/v4.01/os/abnf/.
- OData Vocabularies Version 4.0. Edited by Michael Pizzo, Ralf Handl, and Ram Jeyaraman. Latest stage: http://docs.oasis-open.org/odata/odata-vocabularies/v4.0/odata-vocabularies-v4.0.html.
- OData Common Schema Definition Language (CSDL) JSON Representation Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. Latest stage: https://docs.oasis-open.org/odata/odata-csdl-json/v4.01/odata-csdl-json-v4.01.html.
- OData Common Schema Definition Language (CSDL) XML Representation Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. Latest stage: https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/odata-csdl-xml-v4.01.html.
- OData JSON Format Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Mark Biamonte. Latest stage: https://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html.

**Abstract:**
This specification adds basic grouping and aggregation functionality (such as sum, min, and max) to the Open Data Protocol (OData) without changing any of the base principles of OData.

**Status:**
This document was last revised or approved by the OASIS Open Data Protocol (OData) TC on the above date. The level of approval is also listed above. Check the "Latest stage" location noted above for possible later revisions of this document. Any other numbered Versions and other technical work produced by the Technical Committee (TC) are listed at https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=odata#technical.

TC members should send comments on this document to the TC's email list. Others should send comments to the TC's public comment list, after subscribing to it by following the instructions at the "[Send A Comment](https://www.oasis-open.org/committees/comments/index.php?wg_abbrev=odata)" button on the TC's web page at https://www.oasis-open.org/committees/odata/.

This specification is provided under the [RF on RAND Terms](https://www.oasis-open.org/policies-guidelines/ipr/#RF-on-RAND-Mode) Mode of the [OASIS IPR Policy](https://www.oasis-open.org/policies-guidelines/ipr/), the mode chosen when the Technical Committee was established. For information on whether any patents have been disclosed that may be essential to implementing this specification, and any offers of patent licensing terms, please refer to the Intellectual Property Rights section of the TC's web page (https://www.oasis-open.org/committees/odata/ipr.php).

Note that any machine-readable content ([Computer Language Definitions](https://www.oasis-open.org/policies-guidelines/tc-process-2017-05-26/#wpComponentsCompLang)) declared Normative for this Work Product is provided in separate plain text files. In the event of a discrepancy between any such plain text file and display content in the Work Product's prose narrative document(s), the content in the separate plain text file prevails.

**Key words:**
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119](#RFC2119) and [RFC8174](#RFC8174) when, and only when, they appear in all capitals, as shown here.

**Citation format:**
When referencing this document, the following citation format should be used:

**[OData-Data-Agg-v4.0]**
OData Extension for Data Aggregation Version 4.0. Edited by Ralf Handl, Hubert Heijkers, Gerald Krause, Michael Pizzo, Heiko Theißen, and Martin Zurmuehl. 20 May 2022. OASIS Committee Specification Draft 04. https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.html. Latest stage: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.html.

**Notices:**
Copyright © OASIS Open 2022. All Rights Reserved.

Distributed under the terms of the OASIS IPR Policy, [https://www.oasis-open.org/policies-guidelines/ipr/]. For complete copyright information please see the full Notices section in an Appendix below.
Original file line number Diff line number Diff line change
@@ -1,81 +1,3 @@
## Committee Specification Draft 04

## 28 October 2022

**This stage:**
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.md (Authoritative)
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.html
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.pdf

**Previous stage:**
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/odata-data-aggregation-ext-v4.0-cs02.docx (Authoritative)
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/odata-data-aggregation-ext-v4.0-cs02.html
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/cs02/odata-data-aggregation-ext-v4.0-cs02.pdf

**Latest stage:**
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.md (Authoritative)
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.html
https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.pdf

**Technical Committee:**
[OASIS Open Data Protocol (OData) TC](https://www.oasis-open.org/committees/odata/)

**Chairs:**
Ralf Handl ([email protected]), [SAP SE](https://www.sap.com)
Michael Pizzo ([email protected]), [Microsoft](https://www.microsoft.com)

**Editors:**
Ralf Handl ([email protected]), [SAP SE](https://www.sap.com)
Hubert Heijkers ([email protected]), [IBM](https://www.ibm.com)
Michael Pizzo ([email protected]), [Microsoft](https://www.microsoft.com)
Gerald Krause ([email protected]), [SAP SE](https://www.sap.com)
Heiko Theißen ([email protected]), [SAP SE](https://www.sap.com)
Martin Zurmuehl ([email protected]), [SAP SE](https://www.sap.com)

<a name="AdditionalArtifacts">**Additional artifacts:**</a>
This document is one component of a Work Product that also includes:
- OData Aggregation ABNF Construction Rules Version 4.0: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/abnf/odata-aggregation-abnf.txt
- OData Aggregation ABNF Test Cases: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/abnf/odata-aggregation-testcases.xml
- OData Core Vocabulary: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/vocabularies/Org.OData.Core.V1.xml
- OData Aggregation Vocabulary: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/vocabularies/Org.OData.Aggregation.V1.xml

<a name="RelatedWork">**Related work:**</a>
This document is related to:
- OData Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. A multi-part Work Product which includes:
- OData Version 4.01. Part 1: Protocol. Latest stage: https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html.
- OData Version 4.01. Part 2: URL Conventions. Latest stage: https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html.
- ABNF components: OData ABNF Construction Rules Version 4.01 and OData ABNF Test Cases. https://docs.oasis-open.org/odata/odata/v4.01/os/abnf/.
- OData Vocabularies Version 4.0. Edited by Michael Pizzo, Ralf Handl, and Ram Jeyaraman. Latest stage: http://docs.oasis-open.org/odata/odata-vocabularies/v4.0/odata-vocabularies-v4.0.html.
- OData Common Schema Definition Language (CSDL) JSON Representation Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. Latest stage: https://docs.oasis-open.org/odata/odata-csdl-json/v4.01/odata-csdl-json-v4.01.html.
- OData Common Schema Definition Language (CSDL) XML Representation Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Martin Zurmuehl. Latest stage: https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/odata-csdl-xml-v4.01.html.
- OData JSON Format Version 4.01. Edited by Michael Pizzo, Ralf Handl, and Mark Biamonte. Latest stage: https://docs.oasis-open.org/odata/odata-json-format/v4.01/odata-json-format-v4.01.html.

**Abstract:**
This specification adds basic grouping and aggregation functionality (such as sum, min, and max) to the Open Data Protocol (OData) without changing any of the base principles of OData.

**Status:**
This document was last revised or approved by the OASIS Open Data Protocol (OData) TC on the above date. The level of approval is also listed above. Check the "Latest stage" location noted above for possible later revisions of this document. Any other numbered Versions and other technical work produced by the Technical Committee (TC) are listed at https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=odata#technical.

TC members should send comments on this document to the TC's email list. Others should send comments to the TC's public comment list, after subscribing to it by following the instructions at the "[Send A Comment](https://www.oasis-open.org/committees/comments/index.php?wg_abbrev=odata)" button on the TC's web page at https://www.oasis-open.org/committees/odata/.

This specification is provided under the [RF on RAND Terms](https://www.oasis-open.org/policies-guidelines/ipr/#RF-on-RAND-Mode) Mode of the [OASIS IPR Policy](https://www.oasis-open.org/policies-guidelines/ipr/), the mode chosen when the Technical Committee was established. For information on whether any patents have been disclosed that may be essential to implementing this specification, and any offers of patent licensing terms, please refer to the Intellectual Property Rights section of the TC's web page (https://www.oasis-open.org/committees/odata/ipr.php).

Note that any machine-readable content ([Computer Language Definitions](https://www.oasis-open.org/policies-guidelines/tc-process-2017-05-26/#wpComponentsCompLang)) declared Normative for this Work Product is provided in separate plain text files. In the event of a discrepancy between any such plain text file and display content in the Work Product's prose narrative document(s), the content in the separate plain text file prevails.

**Key words:**
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119](#RFC2119) and [RFC8174](#RFC8174) when, and only when, they appear in all capitals, as shown here.

**Citation format:**
When referencing this document, the following citation format should be used:

**[OData-Data-Agg-v4.0]**
OData Extension for Data Aggregation Version 4.0. Edited by Ralf Handl, Hubert Heijkers, Gerald Krause, Michael Pizzo, Heiko Theißen, and Martin Zurmuehl. 20 May 2022. OASIS Committee Specification Draft 04. https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/csd04/odata-data-aggregation-ext-v4.0-csd04.html. Latest stage: https://docs.oasis-open.org/odata/odata-data-aggregation-ext/v4.0/odata-data-aggregation-ext-v4.0.html.

**Notices:**
Copyright © OASIS Open 2022. All Rights Reserved.

Distributed under the terms of the OASIS IPR Policy, [https://www.oasis-open.org/policies-guidelines/ipr/]. For complete copyright information please see the full Notices section in an Appendix below.

# ##sec Introduction

This specification adds aggregation functionality to the Open Data Protocol (OData) without changing any of the base principles of OData. It defines semantics and a representation for aggregation of data, especially:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 98bf14b

Please sign in to comment.