@linkeddatanotes/md2rdf 0.0.0-stage → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +151 -3
- package/build/src/Md2Rdf.d.ts +394 -0
- package/build/src/Md2Rdf.js +789 -0
- package/build/src/Md2Rdf.js.map +1 -0
- package/build/src/commonNamespaces.ttl +80 -0
- package/build/src/index.d.ts +1 -0
- package/build/src/index.js +11 -0
- package/build/src/index.js.map +1 -0
- package/package.json +56 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Md2Rdf.js","sourceRoot":"","sources":["../../src/Md2Rdf.ts"],"names":[],"mappings":";;;AA6vBA,4CAKC;AA/vBD,kEAAkE;AAClE,8CAAqC;AAErC,gDAAyC;AACzC,2BAAgC;AAChC,+BAA0B;AAyC1B;;;;GAIG;AACH,MAAa,UAAW,SAAQ,KAAK;IACnC;;OAEG;IACH,OAAO,CAAS;IAChB;;;;;OAKG;IACH,QAAQ,CAAsB;IAC9B;;OAEG;IACH,IAAI,CAAU;IAEd;;;;;;;;;OASG;IACH,YACE,KAAc,EACd,OAA4B,EAC5B,IAAa,EACb,QAA8B;QAE9B,iGAAiG;QACjG,IAAI,QAAQ,KAAK,SAAS;YACxB,QAAQ;gBACN,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;oBACtD,CAAC,CAAC,SAAS;oBACX,CAAC,CAAC,OAAO,CAAC;QAChB,KAAK;QACH,iFAAiF;QACjF,0CAA0C;QAC1C,UAAU;YACR,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;YACzB,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;YACjB,gBAAgB;YAChB,OAAO,CAAC,OAAO;YACf,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7B,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AC,CAAC;YACxD,IAAI,QAAQ,EAAE,CAAC;gBACb,6BAA6B;gBAC7B,OAAO,CAAC,KAAK,CAAC,IAAI;gBAChB,OAAO;gBACP,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;gBAC3D,QAAQ;gBACR,CAAC,CAAC,IAAI,CACJ,IAAI,CAAC,cAAc,EACnB,EAAE,CAAC,IAAI,CAAC,KAAK,EACb,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CACnC;gBACD,eAAe;gBACf,CAAC,CAAC,IAAI,CACJ,IAAI,CAAC,cAAc,EACnB,EAAE,CAAC,MAAM,CAAC,YAAY,EACtB,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAC3D,CACF,CAAC;YACJ,CAAC;YACD,YAAY;YACZ,OAAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;IACH,CAAC;CACF","sourcesContent":["// n3 = https://github.com/rdfjs/N3.js\n// https://rdf.js.org/N3.js/docs/N3Parser.html\nimport type {ParserOptions} from 'n3';\n// Explicitly importing Parser not from 'n3', see src/n3-lib.d.ts.\nimport Parser from 'n3/lib/N3Parser';\nimport {DataFactory, Quad, NamedNode} from '@rdfjs/types';\nimport namespace from '@rdfjs/namespace';\nimport {readFileSync} from 'fs';\nimport {join} from 'path';\n\n/**\n * Md2RdfParserOptions to configure Md2Rdf.\n *\n * They are passed on to the N3 Parser.\n */\nexport interface Md2RdfParserOptions extends ParserOptions {\n /**\n * The file IRI of the currently parsed Markdown file.\n * inherited from ParserOptions, described here explicitly to clarify use.\n */\n baseIRI: string;\n\n /**\n * RDF DataFactory to create nodes.\n */\n factory: DataFactory;\n\n /**\n * namespaces set here will be prefixed to every `turtle` block before parsing.\n * Namespaces defined within a block will override.\n * Hint: md2rdf ships common namespaces. Load them with commonNamespaces() and pass them in.\n * Format: turtle string\n */\n namespaces?: string | undefined;\n\n /**\n * Set the onError handler to get information about errors and warnings and to stop the parser when you find necessary.\n * Leave the onError handler empty to let the parser skip all errors and warnings and return as many quads as possible.\n *\n * Implementations of the error handler\n * - may read the passed errors and warnings and notify the user, write them to a log, or to a quadstore\n * - may stop the parser by throwing the error back at the parser\n *\n * @param error a ParseError with a message and more details\n * @throws {ParseError} throws the passed error back to the caller to signal that the parsing should stop now. Swallows it to continue.\n */\n onError?: (error: ParseError) => void;\n}\n\n/**\n * ParseError is passed in the onError() handler of Md2RdfParserOptions.\n * Implementations of the Md2RdfParserOptions.onError() handler should read the ParseError parameter\n * for logging and deciding whether to continue.\n */\nexport class ParseError extends Error {\n /**\n * file IRI of the currently parsed Markdown file.\n */\n baseIRI: string;\n /**\n * severity level\n *\n * error - data cannot be parsed\n * warning - data is parsed but result may be unexpected\n */\n severity: 'error' | 'warning';\n /**\n * Line number within the currently parsed Markdown file.\n */\n line?: number;\n\n /**\n * create a ParseError.\n * Helper function\n * @param cause Underlying error or message.\n * @param options Options to pass the baseIRI of the currently parsed Markdown file.\n * @param line Line number within the currently parsed Markdown file.\n * @param severity Severity level 'error' or 'warning' inspired by methods of `console.`.\n * If severity is not passed, assume 'error' unless the cause Error name ends with string 'Warning'.\n * @returns\n */\n constructor(\n cause: unknown,\n options: Md2RdfParserOptions,\n line?: number,\n severity?: 'error' | 'warning',\n ) {\n // if severity is not passed, assume error unless the cause Error name ends with string 'Warning'\n if (severity === undefined)\n severity =\n cause instanceof Error && cause.name.endsWith('Warning')\n ? 'warning'\n : 'error';\n super(\n // severity: transform the first character to uppercase to have a nicely readable\n // Warning or Error in the message string.\n 'Md2Rdf: ' +\n severity[0].toUpperCase() +\n severity.slice(1) +\n ' parsing file ' +\n options.baseIRI +\n (line ? ' line ' + line : '') +\n ': ' +\n (cause instanceof Error ? cause.message : String(cause)),\n {cause: cause},\n );\n this.name = 'ParseError';\n this.severity = severity;\n this.baseIRI = options.baseIRI;\n this.line = line;\n }\n}\n\n/**\n * HomonymHeadingWarning is a possible cause in ParseError.\n * Example:\n * Heading \"MyHeading\" used for different sections containing a turtle block with \"this:\". IRI \"file#MyHeading\" is homonym for both sections.\n */\nexport class HomonymHeadingWarning extends Error {\n name = 'HomonymHeadingWarning';\n}\n\n/**\n * TimeNoDateInHeadingHierarchyWarning is a possible cause in ParseError.\n * Example:\n * Heading with time \"13:45\" could be nested within a date to define schema:temporalCoverage. No parent date found.\n */\nexport class TimeNoDateInHeadingHierarchyWarning extends Error {\n name = 'TimeNoDateInHeadingHierarchyWarning';\n}\n\n/**\n * Md2Rdf parses Markdown files and returns RDF quads.\n *\n * It follows the minimalistic LinkedDataNotes convention.\n *\n * It makes a \"best effort\" attempt to extract RDF from Markdown. It will report ParseError instances and go on if not stopped.\n * Example: Syntax errors in one turtle code fence break this one fence, but the data in the next turtle code fences may be fine.\n *\n * Documentation: see README of the project.\n *\n */\nexport class Md2Rdf {\n protected options: Md2RdfParserOptions;\n protected optionsNamespaceLineCount = 0;\n // temporary objects and helpers that only exist during a parse operation, shared between objects\n protected context?: ParseContext;\n\n /**\n * parserN3 is loaded lazily using _parserN3() when a Markdown file actually contains `turtle`.\n */\n protected parserN3?: Parser;\n\n constructor(options: Md2RdfParserOptions) {\n this.options = options;\n if (this.options.namespaces) {\n // ensure namespaces ends with a newline\n if (!this.options.namespaces.endsWith('\\n'))\n this.options.namespaces = this.options.namespaces + '\\n';\n this.optionsNamespaceLineCount =\n this.options.namespaces.split('\\n').length - 1;\n }\n }\n\n /**\n * only instantiate the parser when we really need it, to save memory and performance when checking many files\n * @returns lazy-loaded parser\n */\n _parserN3(): Parser {\n return (this.parserN3 ??= new Parser({\n ...this.options,\n format: 'text/n3',\n }));\n }\n\n /**\n * Parse the line.\n * If it is an [atx heading](https://spec.commonmark.org/0.31.2/#atx-heading),\n * 1. remember it in this.headings\n * 2. generate quads that result from the heading, if it contains information according to LinkedDataNotes convention\n * @param line\n * @returns true, when this is a heading\n */\n _parseHeading(line: string): boolean {\n if (!this.context) throw new Error('ParseContext missing');\n // shortcuts\n const c = this.context;\n // parse the line, is it a heading?\n if (c.headings.parseLine(line, this.context.byLine.linenumber ?? 0)) {\n const dateTime = c.headings.dateTimeHierarchy?.toISODateTimeString(\n this.context,\n );\n // there is a 'this:' in the rdfBuffer and a dateTime in the current dateTimeHierarchy.\n // therefore, add the date to the rdf of this block\n if (dateTime) {\n // shortcuts\n const f = this.options.factory;\n const ns = c.ns;\n const thisSectionIRINode = c.headings.prepThisSectionIRI(c);\n if (!thisSectionIRINode) {\n throw new ParseError(\n 'Programming Bug: _parseHeading found heading but prepThisSectionIRI() returns unknown. Line \"' +\n line +\n \"'\",\n this.options,\n c.byLine.linenumber,\n );\n }\n // add temporalCoverage quad\n c.quads.push(\n f.quad(\n thisSectionIRINode,\n ns.schema.temporalCoverage,\n f.literal(dateTime),\n ),\n );\n }\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Parse turtle or N3 syntax from the passed code block from the markdown file\n * @param {String} n3 - the turtle passed as String\n * @param {number} startLine the line number where the block started\n * @return quads the quads parsed from the turtleString as array\n * @throws error , see N3 parse()\n */\n _parseN3String(n3: string, startLine: number) {\n try {\n // Only a shallow evaluation, no full parsing: does the n3 contain a \"this:\" ?\n // A proper implementation would implement a handler that is called when N3 Parser/Lexer\n // identifies a namespace prefix and only then activates the \"this:\" convention.\n const containsThisMarker = n3.includes('this:');\n const thisIRINode = containsThisMarker\n ? this.context?.headings.prepThisSectionIRI(this.context)\n : undefined;\n const s =\n // the default namespaces to prepend before any n3 so authors can implicitly rely on them when writing blocks\n (this.options.namespaces ? this.options.namespaces : '') +\n // \"this:\"\" is a shortcut identifying the current section fragmet id in the current markdown file\n // note to self: '== null' checks both null AND undefined, whereas '=== null' only checks null\n (thisIRINode === undefined\n ? ''\n : 'PREFIX this: <' + thisIRINode.value + '>\\n') +\n n3;\n let quads: Array<Quad> | undefined = undefined;\n try {\n quads = this._parserN3().parse(s);\n } catch (e) {\n // catch and handle N3 block parsing error\n if (e instanceof Error) {\n // replace the line numbering,\n e.message = e.message.replace(\n / on line (\\d+)/,\n (_match, lineStr) =>\n ' on line ' +\n (Number(lineStr) -\n // reducing it by the artificially added optionsNamespaceLineCount\n (this.optionsNamespaceLineCount +\n // and the \"PREFIX this:\"\" line, if it has been added\n (thisIRINode === undefined ? 0 : 1))),\n );\n }\n throw e;\n }\n // append parsed quads to result by mutating target.\n // Intentionally not using the call-stack intensive alternative \"this.context?.quads.push(...quads);\"\n Array.prototype.push.apply(this.context?.quads, quads);\n } catch (e) {\n if (this.options.onError) {\n // wrap it in a ParseError?\n const pe =\n e instanceof ParseError\n ? e\n : new ParseError(e, this.options, startLine + 1);\n // call handler\n this.options.onError(pe);\n }\n }\n }\n\n /**\n * Check if the current line starts with a turtleBlock.\n * If yes, parse the contents of a turtle code fence block and process it\n * @param line - the line to check if it is an opening ```turtle code fence block\n * @returns true, if this line started a turtle block\n */\n _parseTurtleBlock(line: string): boolean {\n // opening fence: up to 3 spaces indent, 3+ backticks or tildes (not mixed), info string turtle\n // note: the (turtle) could be extended to (turtle|ttl|n3|) if we evolve the LinkedDataNotes convention.\n const openMatch = line.match(/^ {0,3}(`{3,}|~{3,})\\s*(turtle)\\s*$/);\n if (!openMatch)\n // if no openMatch, return as quickly as possible\n return false;\n\n // ok, start parsing in detail\n if (!this.context) throw new Error('ParseContext missing');\n\n // closing fence: same character type, at least as many characters, up to 3 spaces indent, only trailing whitespace\n const fenceChar = openMatch[1][0] === '`' ? '`' : '~';\n const closingFence = new RegExp(\n '^ {0,3}' + fenceChar + '{' + openMatch[1].length + ',}\\\\s*$',\n );\n const startLine = this.context.byLine.linenumber;\n let rdfBuffer = '';\n let blockClosed = false;\n for (\n let next = this.context.byLine.next();\n !next.done;\n next = this.context.byLine.next()\n ) {\n if (closingFence.test(next.value)) {\n blockClosed = true;\n break;\n } else {\n rdfBuffer += ('' === rdfBuffer ? '' : '\\n') + next.value;\n }\n }\n\n // was the block properly closed?\n if (!blockClosed && this.options.onError) {\n // handler may throw the passed exception back at us here\n this.options.onError(\n new ParseError(\n 'Block starting at line ' + startLine + ' was never closed',\n this.options,\n startLine,\n ),\n );\n }\n\n // we have a block of turtle string in the rdfBuffer, parse it\n this._parseN3String(rdfBuffer, startLine);\n\n return true;\n }\n\n /**\n * Parses markdown and returns an array of quads.\n * See README.md\n *\n * Note: the method must only be called by a single thread. To parallelize parsing, use two Md2Rdf instances.\n *\n * @param input string of markdown\n * @returns\n * quads: the array of rdf.js Quad parsed so far\n * error: this is the error that stopped the run, it should have been thrown by options.onError.\n * @throws errors when there are unexpected programming bugs\n */\n parseString(input: string): {quads: Array<Quad>; error?: ParseError} {\n if (this.context)\n throw new Error(\n 'parseString() was called while parsing already in progress. Create multiple instances of Md2Rdf for parallel processing.',\n );\n\n // initialize parsing by line\n const byLine = new StringByLine(input);\n\n // context for this parsing run, will be reset at the end of this function\n this.context = new ParseContext(this.options, byLine);\n\n // initialize variables for return values of this function at the end\n let error: ParseError | undefined = undefined;\n let quads: Array<Quad>;\n\n try {\n for (let next = byLine.next(); !next.done; next = byLine.next()) {\n const line = next.value;\n // evaluate in the order of specificality/priority\n // 1. is the line a markdown atx heading? https://spec.commonmark.org/0.31.2/#atx-heading\n // using a logic expression without storing its return value.\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n this._parseHeading(line) ||\n // 2. is the line starting a code fence? https://spec.commonmark.org/0.31.2/#code-fence\n this._parseTurtleBlock(line);\n }\n } catch (errorThrown) {\n if (errorThrown instanceof ParseError)\n // the options.onError handler threw a ParseError that had been passed to it. This signals the parser to stop and return the result.\n error = errorThrown;\n else\n // \"this should not happen\" (tm)\n throw errorThrown;\n } finally {\n // remember the result before deleting the temporary objects\n quads = this.context.quads ?? [];\n // reset temporary objects to undefined, to ensure the parallel processing warning will work\n this.context = undefined;\n }\n return {quads, error};\n }\n}\n\n//////////////////////////////\n// Internal helper Classes\n// not exported\n//////////////////////////////\n\n/**\n * Helper Object to\n * - hold variables during parsing\n * - share helpers between Md2Rdf and Headings2This\n */\nclass ParseContext {\n options: Md2RdfParserOptions;\n // Namespaces\n ns;\n quads: Array<Quad>;\n byLine: StringByLine;\n headings: Headings2This;\n\n constructor(options: Md2RdfParserOptions, byLine: StringByLine) {\n this.options = options;\n this.byLine = byLine;\n // initialize temporary objects shared by the parse functions\n this.quads = [];\n // helper for headings\n this.headings = new Headings2This(this.options);\n\n // namespace constants to write classes and properties.\n // note: must be tied to the same datafactory as Md2Rdf\n const o = {factory: this.options.factory};\n this.ns = {\n rdf: namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#', o),\n rdfs: namespace('http://www.w3.org/2000/01/rdf-schema#', o),\n schema: namespace('https://schema.org/', o),\n md2rdf: namespace('https://www.linkeddatanotes.org/ns/md2rdf/', o),\n };\n }\n}\n\n/**\n * A generator that takes the passed string,\n * splits it by \\r\\n and \\n,\n * yield each line,\n * count current linenumber.\n *\n * Does not split everything in memory in the beginning to save memory.\n *\n * Use as iterator:\n * let by = new StringByLine('example');\n * for (const line of by) {\n * console.log(line);\n * }\n *\n * Use with linenumber: see below in parseString()\n *\n * @param input string\n */\nclass StringByLine {\n input: string;\n linenumber: number = 0;\n start: number = 0;\n idx?: number;\n\n constructor(input: string) {\n this.input = input;\n }\n\n next(): IteratorResult<string> {\n if (this.idx === -1) return {value: undefined, done: true};\n this.idx = this.input.indexOf('\\n', this.start);\n if (this.idx !== -1) {\n this.linenumber++;\n const s = this.input.substring(\n this.start,\n this.idx > 0 && this.input[this.idx - 1] === '\\r'\n ? this.idx - 1\n : this.idx,\n );\n this.start = this.idx + 1;\n return {value: s, done: false};\n }\n return {value: this.input.substring(this.start), done: false};\n }\n\n [Symbol.iterator]() {\n return this;\n }\n}\n\n/**\n * Helper class to concatenate ISO Times from filename and headings.\n *\n * The first element in the DateTimeHierarchy is the current heading (or filename, if no section).\n * It points to a parent element in DateTimeHierarchy for further information.\n *\n * To read it, call toISODateTimeString.\n *\n * Once a date or date+time is found in the time hierarchy, it is returned.\n * If no date is found, undefined is returned.\n *\n * Updating the current DateTimeHierarchy while parsing Markdown is handled by update()\n *\n * Evaluation is lazy: the current hierarchy is stored after every heading,\n * but the regex time parsing is only done when an actual this: element is found in a turtle block\n * to save CPU.\n *\n * Assumptions:\n * - vast majority of Markdown will not contain turtle and `this:`, only seldomly date will be needed\n * - regex parsing costs CPU\n */\nexport class DateTimeHierarchy {\n /**\n * This should match a DATE followed by TIME followed by ZONE\n * DATE is optional\n * TIME is optional, if TIME is set, ZONE is also optional\n * yyyy-mm-dd ... optional\n * 13:55\n * 2021-02-10\n * 2021-02-10 13:55\n * 2021-02-10T13:55\n * 2021-02-10 13:55:44.1234\n * 2021-02-10T13:55Z+01:00\n */\n static readonly DATE_TIME_ZONE =\n /^(\\d{4}-\\d{2}-\\d{2})(?:[T ](\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?)(?:Z?([+-]\\d{2}:\\d{2})|Z)?)?/;\n static readonly TIME_ONLY =\n /^(\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?)(?:Z?([+-]\\d{2}:\\d{2})|Z)?/;\n\n /**\n * Same as DATE_TIME_ZONE, but the date part allows reduced ISO 8601 precision\n * (yyyy or yyyy-mm, not just yyyy-mm-dd), and is anchored at both ends since it\n * is only ever run against a single endpoint token already isolated by DURATION.\n */\n static readonly DATE_TIME_ZONE_FLEX =\n /^(\\d{4}(?:-\\d{2}(?:-\\d{2})?)?)(?:[T ](\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?)(?:Z?([+-]\\d{2}:\\d{2})|Z)?)?$/;\n\n /**\n * Matches a schema:temporalCoverage-style duration: two date/time endpoints\n * separated by \"/\", \"-\" or \"–\" (an ISO 8601 time interval, e.g. \"1939/1945\" or\n * \"2015-11/..\"). The end endpoint may be \"..\" (open-ended), a date/time of its\n * own, or a bare time that shares the start endpoint's date.\n */\n static readonly DURATION =\n /^(\\d{4}(?:-\\d{2}(?:-\\d{2})?)?(?:[T ]\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?(?:Z?[+-]\\d{2}:\\d{2}|Z)?)?)\\s*(?:\\/|-|–)\\s*(\\.\\.|\\d{4}(?:-\\d{2}(?:-\\d{2})?)?(?:[T ]\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?(?:Z?[+-]\\d{2}:\\d{2}|Z)?)?|\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?(?:Z?[+-]\\d{2}:\\d{2}|Z)?)/;\n\n parent?: DateTimeHierarchy;\n /**\n * 0 = filename from baseIRI\n * 1 = h1\n * ...\n * 6 = h6\n */\n level: number;\n /**\n * the content of the heading (after the #)\n * or\n * the filename\n */\n input: string;\n /**\n * was the input already parsed to date/time/zone?\n * for lazy evaluation\n */\n parsed: boolean = false;\n date?: string;\n time?: string;\n zone?: string;\n /**\n * The following three fields are only set when the input is a duration\n * (ISO 8601 time interval, e.g. \"1939/1945\" or \"2015-11/..\").\n * endDate/endTime/endZone hold the end endpoint; when the end endpoint is a\n * bare time (e.g. \"09:00-17:00\"), endDate stays undefined and the start's\n * own date is reused for it.\n */\n endDate?: string;\n endTime?: string;\n endZone?: string;\n /**\n * true when the duration's end endpoint was written as \"..\" (open-ended,\n * e.g. \"2015-11/..\").\n */\n openEnded?: boolean;\n\n constructor(level: number, input: string, parent?: DateTimeHierarchy) {\n this.level = level;\n this.input = input;\n this.parent = parent;\n }\n\n /**\n * In the hierarchy, find the next date.\n * @returns a date if found, as string.\n */\n _findDate(): string | undefined {\n this._parse();\n if (this.date) {\n return this.date;\n }\n return this.parent ? this.parent._findDate() : undefined;\n }\n\n /**\n * Ensure this heading has been parsed before accessing the fields.\n * Read the input, find a date and time, write it into the fields.\n */\n _parse() {\n if (this.parsed) return;\n\n // try duration first: e.g. \"2021-02-10\" alone must not be shadowed by \"2021-02\"/\"10\"\n const durationMatch = DateTimeHierarchy.DURATION.exec(this.input);\n if (durationMatch !== null) {\n const startMatch = DateTimeHierarchy.DATE_TIME_ZONE_FLEX.exec(\n durationMatch[1],\n );\n if (startMatch !== null) {\n this.date = startMatch[1];\n this.time = startMatch[2];\n this.zone = startMatch[3];\n }\n if (durationMatch[2] === '..') {\n this.openEnded = true;\n } else {\n const endMatch = DateTimeHierarchy.DATE_TIME_ZONE_FLEX.exec(\n durationMatch[2],\n );\n if (endMatch !== null) {\n this.endDate = endMatch[1];\n this.endTime = endMatch[2];\n this.endZone = endMatch[3];\n } else {\n // end endpoint has no date of its own (e.g. \"17:00\"), reuse the start's date\n const endTimeMatch = DateTimeHierarchy.TIME_ONLY.exec(\n durationMatch[2],\n );\n if (endTimeMatch !== null) {\n this.endTime = endTimeMatch[1];\n this.endZone = endTimeMatch[2];\n }\n }\n }\n this.parsed = true;\n return;\n }\n\n const match = DateTimeHierarchy.DATE_TIME_ZONE.exec(this.input);\n if (match !== null) {\n this.date = match[1];\n this.time = match[2];\n this.zone = match[3];\n } else {\n const timeMatch = DateTimeHierarchy.TIME_ONLY.exec(this.input);\n if (timeMatch !== null) {\n this.time = timeMatch[1];\n this.zone = timeMatch[2];\n }\n }\n this.parsed = true;\n }\n\n /**\n * true when this heading's input was parsed as a duration (ISO 8601 time\n * interval), i.e. it has an end endpoint or is open-ended.\n */\n get isDuration(): boolean {\n this._parse();\n return (\n this.openEnded === true ||\n this.endDate !== undefined ||\n this.endTime !== undefined\n );\n }\n\n /**\n * Read the current Heading Hierarchy and format it as a schema:temporalCoverage value:\n * either a plain ISO 8601 date/date-time, or - when the heading was written as a\n * duration - an ISO 8601 time interval such as \"1939/1945\" or \"2015-11/..\".\n * @returns the ISO 8601 date/date-time or interval defined by the heading hierarchy, or undefined if none found.\n * @throws DoubleTimeInHeadingHierarchyWarning, TimeNoDateInHeadingHierarchyWarning\n */\n toISODateTimeString(context: ParseContext): string | undefined {\n this._parse();\n if (this.isDuration) {\n // this.date is always set for a duration: DURATION's start endpoint always includes a year.\n const start =\n this.date + (this.time ? 'T' + this.time + (this.zone ?? '') : '');\n const end = this.openEnded\n ? '..'\n : this.endDate !== undefined\n ? this.endDate +\n (this.endTime ? 'T' + this.endTime + (this.endZone ?? '') : '')\n : this.date + 'T' + this.endTime + (this.endZone ?? '');\n return start + '/' + end;\n }\n if (this.date !== undefined) {\n // this is a date, return it\n return this.date + (this.time ? 'T' + this.time + (this.zone ?? '') : '');\n } else {\n if (this.time !== undefined) {\n // there is a time, look for a \"date\" in the parents\n const parentDate = this.parent ? this.parent._findDate() : undefined;\n if (parentDate !== undefined) {\n return (\n parentDate + (this.time ? 'T' + this.time + (this.zone ?? '') : '')\n );\n } else {\n if (context.options.onError) {\n context.options.onError(\n new ParseError(\n new TimeNoDateInHeadingHierarchyWarning(\n 'Heading with time \"' +\n this.time +\n '\" could be nested within a date to define schema:temporalCoverage. No parent date found.',\n ),\n context.options,\n context.byLine.linenumber,\n ),\n );\n }\n return undefined; // TimeNoDateInHeadingHierarchyWarning\n }\n } else {\n // no time\n return undefined;\n }\n }\n }\n\n /**\n * update the DateTimeHierarchy based on the latest input\n * @param level current level\n * @param input content of the heading, after \"#\"\n * @param parent parent in the DateTimeHierarchy\n * @returns an update pointer to the current relevant heading or file in the DateTimeHierarchy\n */\n static update(\n level: number,\n input: string,\n parent?: DateTimeHierarchy,\n ): DateTimeHierarchy | undefined {\n if (parent === undefined) {\n if (level !== 0)\n throw new Error(\n 'DateTimeHierarchy: when initializing with an empty parent, the level must be 0',\n );\n return new DateTimeHierarchy(level, input);\n } else {\n // there is a parent\n if (!(level >= 1))\n throw new Error(\n 'DateTimeHierarchy: updating a hierarchy, and there is a parent, level for a new heading must be >= 1. Level: ' +\n level,\n );\n while (parent && parent.level >= level && parent.parent) {\n // the new input is working with the parent of this parent\n parent = parent.parent;\n }\n return new DateTimeHierarchy(level, input, parent);\n }\n }\n}\n\n/**\n * cache for loadCommonNamespaces\n */\nlet cachedCommonNamespaces: string | undefined;\n\n/**\n * Lazily load and cache the commonNamespaces.ttl shipped with md2rdf.\n * @returns the common namespaces as turtle string\n */\nexport function commonNamespaces(): string {\n return (cachedCommonNamespaces ??= readFileSync(\n join(__dirname, 'commonNamespaces.ttl'),\n 'utf-8',\n ));\n}\n\n/**\n * Handling of headings and `this:`\n */\nclass Headings2This {\n // Parameters in the order they build upon each other\n /**\n * reusable regex to match headings\n */\n matchHeading = /^(#{1,6}) (.*)/;\n /**\n * Buffer for the last heading content that was passed to parseLine,\n * to be used when needed by prepThisSectionIRI.\n * It is the \"content\" after the hash-marks and the space\n * https://spec.commonmark.org/0.31.2/#atx-headings\n */\n lastHeadingContent: string | undefined;\n /**\n * line number of the lastHeadingContent\n */\n lastHeadingLinenumber: number | undefined;\n /**\n * The URI for the current section after the lastHeadingContent.\n * Initiated undefined and reset to undefined after each heading, initialized lazily when needed.\n */\n thisSectionIRI: NamedNode<string> | undefined;\n /**\n * multiple headings having the same hash?\n * remember them to send a warning\n */\n usedThisIRIs = new Set();\n /**\n * Time and date data found in the hierarchy of\n * - filename (baseIRI) and\n * - headings 1 to 6\n */\n dateTimeHierarchy?: DateTimeHierarchy;\n\n /**\n * Passing options\n * @param options\n */\n constructor(protected options: Md2RdfParserOptions) {\n // the slash / in the group [] doesnt need to be escaped\n let filename = options.baseIRI.replace(/^.*[/:]/, '');\n filename = decodeURI(filename); // %20 -> ' ', etc.\n this.dateTimeHierarchy = DateTimeHierarchy.update(0, filename);\n }\n\n /**\n * Translate thea markdown heading to a fragment which can be used in an IRI.\n * See LinkeDataNotes-Markdown Syntax\n * @param {String} headingContent the content of the heading. This is the string after the ATX heading hash-marks and space (not including leading hash-signs). https://spec.commonmark.org/0.31.2/#atx-headings\n * @return {String} the fragment\n */\n _headingToFragment(headingContent: string): string {\n // replace all(=g) space by -\n let fragment = headingContent.replace(/ /g, '-');\n // encode non-URI chars\n fragment = encodeURIComponent(fragment);\n return fragment;\n }\n\n /**\n * create a section IRI based on file and fragment\n */\n _createSectionIri(inputfileIRI: string, fragment: string): string {\n return inputfileIRI + '#' + fragment;\n }\n\n /**\n * Parse the line for a heading starting with `#`, see [atx heading](https://spec.commonmark.org/0.31.2/#atx-heading).\n * It remembers the headings that were passed to it, should they be later needed by prepThisSectionIRI() or the dateTimeHierarchy.\n * @param line the Markdown line\n * @param linenumber the current line number, should it be needed for error logging later\n * @returns true, when the current line is an atx heading starting with '#'\n */\n parseLine(line: string, linenumber: number): boolean {\n // is it a heading?\n const match = this.matchHeading.exec(line);\n if (match) {\n // remember the heading\n // trim() because [atx heading](https://spec.commonmark.org/0.31.2/#atx-heading) says:\n // \"Leading and trailing spaces or tabs are ignored in parsing inline content\"\n this.lastHeadingContent = match[2].trim();\n // reset this.thisSectionIRI as mark for prepThisSectionIRI later that it creates the quads only once\n this.thisSectionIRI = undefined;\n this.lastHeadingLinenumber = linenumber;\n\n // remember hierarchy from Filename down to Headings\n const level = match[1].length; // the group in the regex matching the ###\n this.dateTimeHierarchy = DateTimeHierarchy.update(\n level,\n this.lastHeadingContent,\n this.dateTimeHierarchy,\n );\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * Prepare the current section IRI, as the caller will use it in quads.\n *\n * This:\n * - mints the IRI, remembers it as node for reuse further down the section\n * - adds metadata about the section via quads.push()\n *\n * @returns the section IRI as RDF Node or undefined if no heading was in the file yet\n */\n prepThisSectionIRI(context: ParseContext): undefined | NamedNode<string> {\n // return the cached result, if it exists\n if (this.thisSectionIRI) {\n return this.thisSectionIRI;\n } else {\n // prep thisSectionIRI and keep it to reuse it\n\n // Syntax: this is only supported after the first heading\n if (this.lastHeadingContent === undefined) {\n // leave thisSectionIRI as undefined\n return undefined;\n }\n // identify thisSectionIRI based on last heading\n const fragment = this._headingToFragment(this.lastHeadingContent);\n const thisSectionIRIString = this._createSectionIri(\n this.options.baseIRI,\n fragment,\n );\n // check if thisSectionIRI already appeared in a previous section\n const firstUse = !this.usedThisIRIs.has(fragment);\n if (!firstUse) {\n // onError Handler set?\n if (this.options.onError)\n // call it!\n this.options.onError(\n new ParseError(\n new HomonymHeadingWarning(\n 'Heading \"' +\n this.lastHeadingContent +\n '\" used for different sections containing a turtle block with \"this:\". IRI \"' +\n thisSectionIRIString +\n '\" is homonym for both sections.',\n ),\n this.options,\n this.lastHeadingLinenumber,\n ),\n );\n } else this.usedThisIRIs.add(fragment);\n // shortcuts\n const f = context.options.factory;\n const ns = context.ns;\n // create the Node\n this.thisSectionIRI = f.namedNode(thisSectionIRIString);\n if (firstUse) {\n // first use, add annotations\n context.quads.push(\n // type\n f.quad(this.thisSectionIRI, ns.rdf.type, ns.md2rdf.Section),\n // label\n f.quad(\n this.thisSectionIRI,\n ns.rdfs.label,\n f.literal(this.lastHeadingContent),\n ),\n // headingLevel\n f.quad(\n this.thisSectionIRI,\n ns.md2rdf.headingLevel,\n f.literal((this.dateTimeHierarchy?.level ?? 0).toString()),\n ),\n );\n }\n // return it\n return this.thisSectionIRI;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# common namespaces shipped with LinkedDataNotes
|
|
2
|
+
# URL: https://www.linkeddatanotes.org/ns/commonNamespaces.ttl
|
|
3
|
+
# Created: 2021-02-10
|
|
4
|
+
# Modified: 2026-10-25
|
|
5
|
+
# README: https://www.linkeddatanotes.org/ns/commonNamespaces
|
|
6
|
+
#
|
|
7
|
+
# This builds on reading and interpreting the following sources from the RDF community:
|
|
8
|
+
#
|
|
9
|
+
# W3C rdfa
|
|
10
|
+
# https://www.w3.org/2010/02/rdfa/drafts/default_prefixes.html
|
|
11
|
+
#
|
|
12
|
+
# solid-namespace
|
|
13
|
+
# https://github.com/solid/solid-namespace/blob/master/index.js
|
|
14
|
+
|
|
15
|
+
@prefix acl: <http://www.w3.org/ns/auth/acl#> .
|
|
16
|
+
@prefix arg: <http://www.w3.org/ns/pim/arg#> .
|
|
17
|
+
@prefix as: <https://www.w3.org/ns/activitystreams#> .
|
|
18
|
+
@prefix bookmark: <http://www.w3.org/2002/01/bookmark#> .
|
|
19
|
+
@prefix cal: <http://www.w3.org/2002/12/cal/ical#> .
|
|
20
|
+
@prefix cc: <http://creativecommons.org/ns#> .
|
|
21
|
+
@prefix cco: <http://www.ontologyrepository.com/CommonCoreOntologies/> .
|
|
22
|
+
@prefix cert: <http://www.w3.org/ns/auth/cert#> .
|
|
23
|
+
@prefix contact: <http://www.w3.org/2000/10/swap/pim/contact#> .
|
|
24
|
+
@prefix dc: <http://purl.org/dc/elements/1.1/> .
|
|
25
|
+
@prefix dct: <http://purl.org/dc/terms/> .
|
|
26
|
+
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
|
27
|
+
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
|
28
|
+
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
|
|
29
|
+
@prefix gpx: <http://www.w3.org/ns/pim/gpx#> .
|
|
30
|
+
@prefix gr: <http://purl.org/goodrelations/v1#> .
|
|
31
|
+
@prefix grddl: <http://www.w3.org/2003/g/data-view#> .
|
|
32
|
+
@prefix http: <http://www.w3.org/2007/ont/http#> .
|
|
33
|
+
@prefix httph: <http://www.w3.org/2007/ont/httph#> .
|
|
34
|
+
@prefix icalTZ: <http://www.w3.org/2002/12/cal/icaltzd#> .
|
|
35
|
+
@prefix ldp: <http://www.w3.org/ns/ldp#> .
|
|
36
|
+
@prefix link: <http://www.w3.org/2007/ont/link#> .
|
|
37
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
38
|
+
@prefix meeting: <http://www.w3.org/ns/pim/meeting#> .
|
|
39
|
+
@prefix mo: <http://purl.org/ontology/mo/> .
|
|
40
|
+
@prefix nrl: <https://www.semanticdesktop.org/ontologies/2007/08/15/nrl/#> .
|
|
41
|
+
@prefix org: <http://www.w3.org/ns/org#> .
|
|
42
|
+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
|
43
|
+
@prefix pad: <http://www.w3.org/ns/pim/pad#> .
|
|
44
|
+
@prefix patch: <http://www.w3.org/ns/pim/patch#> .
|
|
45
|
+
@prefix prov: <http://www.w3.org/ns/prov#> .
|
|
46
|
+
@prefix pto: <http://www.productontology.org/id/> .
|
|
47
|
+
@prefix qu: <http://www.w3.org/2000/10/swap/pim/qif#> .
|
|
48
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
49
|
+
@prefix rdfa: <http://www.w3.org/ns/rdfa#> .
|
|
50
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
51
|
+
@prefix rif: <http://www.w3.org/2007/rif#> .
|
|
52
|
+
@prefix rss: <http://purl.org/rss/1.0/> .
|
|
53
|
+
@prefix sched: <http://www.w3.org/ns/pim/schedule#> .
|
|
54
|
+
@prefix schema: <https://schema.org/> .
|
|
55
|
+
@prefix sioc: <http://rdfs.org/sioc/ns#> .
|
|
56
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
|
|
57
|
+
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
|
|
58
|
+
@prefix solid: <http://www.w3.org/ns/solid/terms#> .
|
|
59
|
+
@prefix space: <http://www.w3.org/ns/pim/space#> .
|
|
60
|
+
@prefix stat: <http://www.w3.org/ns/posix/stat#> .
|
|
61
|
+
@prefix tab: <http://www.w3.org/2007/ont/link#> .
|
|
62
|
+
@prefix tabont: <http://www.w3.org/2007/ont/link#> .
|
|
63
|
+
@prefix trip: <http://www.w3.org/ns/pim/trip#> .
|
|
64
|
+
@prefix ui: <http://www.w3.org/ns/ui#> .
|
|
65
|
+
@prefix vann: <http://purl.org/vocab/vann/> .
|
|
66
|
+
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
|
|
67
|
+
@prefix wdr: <http://www.w3.org/2007/05/powder#> .
|
|
68
|
+
@prefix wdrs: <http://www.w3.org/2007/05/powder-s#> .
|
|
69
|
+
@prefix wf: <http://www.w3.org/2005/01/wf/flow#> .
|
|
70
|
+
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
|
|
71
|
+
@prefix xmlns: <http://www.w3.org/2000/xmlns/> .
|
|
72
|
+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
73
|
+
|
|
74
|
+
# LinkedDataNotes: The adhoc namespace as explicit namespace
|
|
75
|
+
@prefix adhoc: <https://www.linkeddatanotes.org/ns/adhoc/> .
|
|
76
|
+
# LinkedDataNotes: The adhoc namespace as implicit namespace of the current file
|
|
77
|
+
@prefix : <https://www.linkeddatanotes.org/ns/adhoc/> .
|
|
78
|
+
|
|
79
|
+
# LinkedDataNotes: md2rdf
|
|
80
|
+
@prefix md2rdf: <https://www.linkeddatanotes.org/ns/md2rdf/> .
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Md2Rdf, Md2RdfParserOptions, ParseError, HomonymHeadingWarning, TimeNoDateInHeadingHierarchyWarning, DateTimeHierarchy, commonNamespaces, } from './Md2Rdf';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commonNamespaces = exports.DateTimeHierarchy = exports.TimeNoDateInHeadingHierarchyWarning = exports.HomonymHeadingWarning = exports.ParseError = exports.Md2Rdf = void 0;
|
|
4
|
+
var Md2Rdf_1 = require("./Md2Rdf");
|
|
5
|
+
Object.defineProperty(exports, "Md2Rdf", { enumerable: true, get: function () { return Md2Rdf_1.Md2Rdf; } });
|
|
6
|
+
Object.defineProperty(exports, "ParseError", { enumerable: true, get: function () { return Md2Rdf_1.ParseError; } });
|
|
7
|
+
Object.defineProperty(exports, "HomonymHeadingWarning", { enumerable: true, get: function () { return Md2Rdf_1.HomonymHeadingWarning; } });
|
|
8
|
+
Object.defineProperty(exports, "TimeNoDateInHeadingHierarchyWarning", { enumerable: true, get: function () { return Md2Rdf_1.TimeNoDateInHeadingHierarchyWarning; } });
|
|
9
|
+
Object.defineProperty(exports, "DateTimeHierarchy", { enumerable: true, get: function () { return Md2Rdf_1.DateTimeHierarchy; } });
|
|
10
|
+
Object.defineProperty(exports, "commonNamespaces", { enumerable: true, get: function () { return Md2Rdf_1.commonNamespaces; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAQkB;AAPhB,gGAAA,MAAM,OAAA;AAEN,oGAAA,UAAU,OAAA;AACV,+GAAA,qBAAqB,OAAA;AACrB,6HAAA,mCAAmC,OAAA;AACnC,2GAAA,iBAAiB,OAAA;AACjB,0GAAA,gBAAgB,OAAA","sourcesContent":["export {\n Md2Rdf,\n Md2RdfParserOptions,\n ParseError,\n HomonymHeadingWarning,\n TimeNoDateInHeadingHierarchyWarning,\n DateTimeHierarchy,\n commonNamespaces,\n} from './Md2Rdf';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkeddatanotes/md2rdf",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Reads a Markdown string, detects linked data according to the LinkedDataNotes convention, and returns the linked data.",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"main": "build/src/index.js",
|
|
9
|
+
"types": "build/src/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"build/src"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/linkeddatanotes/md2rdf.git"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/linkeddatanotes/md2rdf#readme",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/linkeddatanotes/md2rdf/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"linkeddata",
|
|
24
|
+
"linkeddatanotes",
|
|
25
|
+
"markdown",
|
|
26
|
+
"rdf",
|
|
27
|
+
"rdfjs"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "mocha build/test/*test*.js",
|
|
31
|
+
"lint": "gts lint",
|
|
32
|
+
"fix": "gts fix",
|
|
33
|
+
"clean": "gts clean",
|
|
34
|
+
"precompile": "gts clean",
|
|
35
|
+
"compile": "tsc",
|
|
36
|
+
"postcompile": "node -e \"require('fs').copyFileSync('src/commonNamespaces.ttl','build/src/commonNamespaces.ttl')\"",
|
|
37
|
+
"pretest": "npm run compile",
|
|
38
|
+
"posttest": "npm run lint",
|
|
39
|
+
"prepare": "npm run compile",
|
|
40
|
+
"preversion": "npm test",
|
|
41
|
+
"postversion": "git push --follow-tags",
|
|
42
|
+
"prepublishOnly": "npm test"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/mocha": "^10.0.10",
|
|
46
|
+
"@types/n3": "^1.26.1",
|
|
47
|
+
"@types/node": "^22.7.5",
|
|
48
|
+
"@types/rdfjs__namespace": "^2.0.10",
|
|
49
|
+
"gts": "^7.0.0",
|
|
50
|
+
"mocha": "^12.0.1",
|
|
51
|
+
"typescript": "^5.6.3"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@rdfjs/namespace": "^2.0.1",
|
|
55
|
+
"@rdfjs/types": "^2.0.1",
|
|
56
|
+
"n3": "^2.0.1"
|
|
57
|
+
}
|
|
58
|
+
}
|