Skip to content

Commit

Permalink
build: do not require @zazuko/rdf-vocabularies at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Feb 28, 2020
1 parent ac77a2f commit 3019d71
Show file tree
Hide file tree
Showing 73 changed files with 104 additions and 88 deletions.
4 changes: 2 additions & 2 deletions build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { createDefaultModule } from './defaultModule'
const printer = ts.createPrinter()
const outDir = resolve(process.argv[2])

const promises = Object.keys(prefixes).map(prefix => {
return createPrefixFile(prefix).then(file => {
const promises = Object.entries(prefixes).map(([prefix, namespace]) => {
return createPrefixFile(prefix, namespace).then(file => {
writeFileSync(resolve(outDir, 'vocabularies', file.fileName), printer.printFile(file))
})
})
Expand Down
7 changes: 2 additions & 5 deletions build/prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import imports from './imports'
import { generateInterface } from './interface'
import { aliases, toProperCase } from './strings'

export async function createPrefixFile(prefix: string) {
export async function createPrefixFile(prefix: string, namespace: string) {
return ts.updateSourceFileNode(
ts.createSourceFile(`${prefix}.ts`, '', ts.ScriptTarget.Latest),
[
Expand All @@ -21,10 +21,7 @@ export async function createPrefixFile(prefix: string) {
),
ts.createAsExpression(
ts.createCall(ts.createIdentifier('namespace'), undefined, [
ts.createPropertyAccess(
ts.createIdentifier('prefixes'),
ts.createIdentifier(prefix)
),
ts.createStringLiteral(namespace),
]),
ts.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword)
)
Expand Down
39 changes: 29 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"dependencies": {
"@rdfjs/namespace": "^1.1.0",
"@types/rdfjs__namespace": "^1.1.1",
"@types/rdf-js": "^2.0.11",
"@zazuko/rdf-vocabularies": "^2020.2.11"
"@types/rdf-js": "^2.0.11"
},
"devDependencies": {
"@babel/preset-env": "^7.8.3",
Expand All @@ -38,6 +37,7 @@
"@types/yargs": "^15.0.3",
"@typescript-eslint/eslint-plugin": "^2.19.0",
"@typescript-eslint/parser": "^2.19.0",
"@zazuko/rdf-vocabularies": "^2020.2.11",
"clownface": "^0.12.1",
"cz-conventional-changelog": "^3.0.2",
"eslint-plugin-jest": "^23.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/vocabularies/as.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ type As = NamespaceBuilder & {
/*Specifies the preferred display width of the content, expressed in terms of device independent pixels.*/
"width": NamedNode;
};
export const as: As = (namespace(prefixes.as) as any);
export const as: As = (namespace("http://www.w3.org/ns/activitystreams#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/cc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ type Cc = NamespaceBuilder & {
"requires": NamedNode;
"useGuidelines": NamedNode;
};
export const cc: Cc = (namespace(prefixes.cc) as any);
export const cc: Cc = (namespace("http://creativecommons.org/ns#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/cnt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ type Cnt = NamespaceBuilder & {
/*The XML version declared in the XML declaration.*/
"version": NamedNode;
};
export const cnt: Cnt = (namespace(prefixes.cnt) as any);
export const cnt: Cnt = (namespace("http://www.w3.org/2011/content#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/csvw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,4 @@ type Csvw = NamespaceBuilder & {
/*A boolean atomic property taking a single value which indicates whether the column is a virtual column not present in the original source*/
"virtual": NamedNode;
};
export const csvw: Csvw = (namespace(prefixes.csvw) as any);
export const csvw: Csvw = (namespace("http://www.w3.org/ns/csvw#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/ctag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { prefixes } from "@zazuko/rdf-vocabularies";
import namespace, { NamespaceBuilder } from "@rdfjs/namespace";
import { NamedNode } from "rdf-js";
type Ctag = NamespaceBuilder & {};
export const ctag: Ctag = (namespace(prefixes.ctag) as any);
export const ctag: Ctag = (namespace("http://commontag.org/ns#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/dbo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4544,4 +4544,4 @@ type Dbo = NamespaceBuilder & {
"Tribus": NamedNode;
"MilitaryConflict,_AdministrativeRegion": NamedNode;
};
export const dbo: Dbo = (namespace(prefixes.dbo) as any);
export const dbo: Dbo = (namespace("http://dbpedia.org/ontology/") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/dc11.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ type Dc11 = NamespaceBuilder & {
/*The nature or genre of the resource.*/
"type": NamedNode;
};
export const dc11: Dc11 = (namespace(prefixes.dc11) as any);
export const dc11: Dc11 = (namespace("http://purl.org/dc/elements/1.1/") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/dcat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ type Dcat = NamespaceBuilder & {
/*El sistema de organización del conocimiento utilizado para clasificar conjuntos de datos de catálogos.*/
"themeTaxonomy": NamedNode;
};
export const dcat: Dcat = (namespace(prefixes.dcat) as any);
export const dcat: Dcat = (namespace("http://www.w3.org/ns/dcat#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/dcterms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ type Dcterms = NamespaceBuilder & {
"valid": NamedNode;
"Extent": NamedNode;
};
export const dcterms: Dcterms = (namespace(prefixes.dcterms) as any);
export const dcterms: Dcterms = (namespace("http://purl.org/dc/terms/") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/dqv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ type Dqv = NamespaceBuilder & {
/*Refers to values computed by metric.*/
"value": NamedNode;
};
export const dqv: Dqv = (namespace(prefixes.dqv) as any);
export const dqv: Dqv = (namespace("http://www.w3.org/ns/dqv#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/dtype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ type Dtype = NamespaceBuilder & {
"type": NamedNode;
"value": NamedNode;
};
export const dtype: Dtype = (namespace(prefixes.dtype) as any);
export const dtype: Dtype = (namespace("http://www.linkedmodel.org/schema/dtype#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/duv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ type Duv = NamespaceBuilder & {
/*Dataset associated with Usage. */
"refersTo": NamedNode;
};
export const duv: Duv = (namespace(prefixes.duv) as any);
export const duv: Duv = (namespace("http://www.w3.org/ns/duv#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/foaf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ type Foaf = NamespaceBuilder & {
/*A Yahoo chat ID*/
"yahooChatID": NamedNode;
};
export const foaf: Foaf = (namespace(prefixes.foaf) as any);
export const foaf: Foaf = (namespace("http://xmlns.com/foaf/0.1/") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/frbr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,4 @@ type Frbr = NamespaceBuilder & {
/*It identifies the original expression of a translated one.*/
"translationOf": NamedNode;
};
export const frbr: Frbr = (namespace(prefixes.frbr) as any);
export const frbr: Frbr = (namespace("http://purl.org/vocab/frbr/core#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/geo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,4 @@ type Geo = NamespaceBuilder & {
*/
"wktLiteral": NamedNode;
};
export const geo: Geo = (namespace(prefixes.geo) as any);
export const geo: Geo = (namespace("http://www.opengis.net/ont/geosparql#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/geof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ type Geof = NamespaceBuilder & {
"symDifference": NamedNode;
"union": NamedNode;
};
export const geof: Geof = (namespace(prefixes.geof) as any);
export const geof: Geof = (namespace("http://www.opengis.net/def/function/geosparql/") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/geor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ type Geor = NamespaceBuilder & {
"sfTouches": NamedNode;
"sfWithin": NamedNode;
};
export const geor: Geor = (namespace(prefixes.geor) as any);
export const geor: Geor = (namespace("http://www.opengis.net/def/rule/geosparql/") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/gml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import { prefixes } from "@zazuko/rdf-vocabularies";
import namespace, { NamespaceBuilder } from "@rdfjs/namespace";
import { NamedNode } from "rdf-js";
type Gml = NamespaceBuilder & {};
export const gml: Gml = (namespace(prefixes.gml) as any);
export const gml: Gml = (namespace("http://www.opengis.net/ont/gml#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/gn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -766,4 +766,4 @@ type Gn = NamespaceBuilder & {
/*A Wikipedia article of which subject is the resource.*/
"wikipediaArticle": NamedNode;
};
export const gn: Gn = (namespace(prefixes.gn) as any);
export const gn: Gn = (namespace("http://www.geonames.org/ontology#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/gr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,4 +730,4 @@ type Gr = NamespaceBuilder & {
Typical unit code(s): CMT for centimeters, INH for inches*/
"width": NamedNode;
};
export const gr: Gr = (namespace(prefixes.gr) as any);
export const gr: Gr = (namespace("http://purl.org/goodrelations/v1#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/grddl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ type Grddl = NamespaceBuilder & {
document node*/
"transformationProperty": NamedNode;
};
export const grddl: Grddl = (namespace(prefixes.grddl) as any);
export const grddl: Grddl = (namespace("http://www.w3.org/2003/g/data-view#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/gtfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ type Gtfs = NamespaceBuilder & {
"zone": NamedNode;
"Transfer": NamedNode;
};
export const gtfs: Gtfs = (namespace(prefixes.gtfs) as any);
export const gtfs: Gtfs = (namespace("http://vocab.gtfs.org/terms#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ type Http = NamespaceBuilder & {
/*The status code value of an HTTP response.*/
"statusCodeValue": NamedNode;
};
export const http: Http = (namespace(prefixes.http) as any);
export const http: Http = (namespace("http://www.w3.org/2011/http#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/hydra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ type Hydra = NamespaceBuilder & {
/*True if the client can change the property's value, false otherwise.*/
"writeable": NamedNode;
};
export const hydra: Hydra = (namespace(prefixes.hydra) as any);
export const hydra: Hydra = (namespace("http://www.w3.org/ns/hydra/core#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/ical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ type Ical = NamespaceBuilder & {
"version": NamedNode;
"wkst": NamedNode;
};
export const ical: Ical = (namespace(prefixes.ical) as any);
export const ical: Ical = (namespace("http://www.w3.org/2002/12/cal/icaltzd#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/ldp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ type Ldp = NamespaceBuilder & {
/*Predicate used to specify the order of the members across a page sequence's in-sequence page resources; it asserts nothing about the order of members in the representation of a single page.*/
"pageSortPredicate": NamedNode;
};
export const ldp: Ldp = (namespace(prefixes.ldp) as any);
export const ldp: Ldp = (namespace("http://www.w3.org/ns/ldp#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/lvont.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ type Lvont = NamespaceBuilder & {
/*The property of being a variant of another resource.*/
"variant": NamedNode;
};
export const lvont: Lvont = (namespace(prefixes.lvont) as any);
export const lvont: Lvont = (namespace("http://lexvo.org/ontology#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/ma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ type Ma = NamespaceBuilder & {
/*Corresponds to 'fragment.name' in the Ontology for Media Resources, for Track fragments.*/
"trackName": NamedNode;
};
export const ma: Ma = (namespace(prefixes.ma) as any);
export const ma: Ma = (namespace("http://www.w3.org/ns/ma-ont#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/oa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ type Oa = NamespaceBuilder & {
/*A object of the relationship is a resource from which the source resource was retrieved by the providing system.*/
"via": NamedNode;
};
export const oa: Oa = (namespace(prefixes.oa) as any);
export const oa: Oa = (namespace("http://www.w3.org/ns/oa#") as any);
2 changes: 1 addition & 1 deletion src/vocabularies/og.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ type Og = NamespaceBuilder & {
/*A relevant video URL for your object.*/
"video": NamedNode;
};
export const og: Og = (namespace(prefixes.og) as any);
export const og: Og = (namespace("http://ogp.me/ns#") as any);

0 comments on commit 3019d71

Please sign in to comment.