@ng-org/shex-orm 0.1.2-alpha.5 → 0.1.2-alpha.7
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/README.md
CHANGED
|
@@ -23,11 +23,11 @@ npx rdf-orm build --input ./src/shapes/shex --output ./src/shapes/orm
|
|
|
23
23
|
The input directory needs to contain shex files with one or more shape definitions each, for example:
|
|
24
24
|
|
|
25
25
|
```shex
|
|
26
|
-
PREFIX ex: <
|
|
26
|
+
PREFIX ex: <did:ng:z:>
|
|
27
27
|
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
|
|
28
28
|
|
|
29
29
|
ex:ExpenseShape {
|
|
30
|
-
a [ex:Person] ; # Required type <
|
|
30
|
+
a [ex:Person] ; # Required type <did:ng:z:Person>
|
|
31
31
|
ex:name xsd:string ; # Required string
|
|
32
32
|
ex:email xsd:string * ; # Zero or more strings (set)
|
|
33
33
|
ex:height xsd:float ; # Required number
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShexJTypingTransformer.d.ts","sourceRoot":"","sources":["../../../src/schema-converter/transformers/ShexJTypingTransformer.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,eAAO,MAAM,4BAA4B,aAAoB,CAAC;AAE9D,MAAM,WAAW,yBAAyB;IACtC,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7D;AAeD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,UAOvC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,G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;;YAE1B;QAAE,MAAM,EAAE,GAAG,CAAC,mBAAmB,EAAE,CAAA;KAAE;eAClC;QAAE,MAAM,EAAE,GAAG,CAAC,oBAAoB,CAAA;KAAE;WACxC;QAAE,MAAM,EAAE,GAAG,CAAC,oBAAoB,CAAA;KAAE;YACnC;QAAE,MAAM,EAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,oBAAoB,CAAA;KAAE;sBAC3C;QAAE,MAAM,EAAE,GAAG,CAAC,mBAAmB,CAAA;KAAE;oBACrC;QAAE,MAAM,EAAE,GAAG,CAAC,IAAI,CAAA;KAAE;aAC3B;QAAE,MAAM,EAAE,GAAG,CAAC,SAAS,CAAA;KAAE;cACxB;QAAE,MAAM,EAAE,GAAG,CAAC,gBAAgB,CAAA;KAAE;cAChC;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;mBACZ;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE;QAwctC,CAAC"}
|
|
@@ -32,21 +32,9 @@ export function toCamelCase(text) {
|
|
|
32
32
|
* Name functions
|
|
33
33
|
*/
|
|
34
34
|
export function iriToName(iri) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (url.hash) {
|
|
39
|
-
name = url.hash.slice(1);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
const splitPathname = url.pathname.split("/");
|
|
43
|
-
name = splitPathname[splitPathname.length - 1];
|
|
44
|
-
}
|
|
45
|
-
return name.replace(/(?<!^)Shape$/, "");
|
|
46
|
-
}
|
|
47
|
-
catch (err) {
|
|
48
|
-
return iri;
|
|
49
|
-
}
|
|
35
|
+
const lastSegment = iri.split(/[\/:#?@&=]/).at(-1);
|
|
36
|
+
// Remove *Shape part of name, if it exists.
|
|
37
|
+
return lastSegment.replace(/(?<!^)Shape$/, "");
|
|
50
38
|
}
|
|
51
39
|
export function nameFromAnnotationOrId(obj) {
|
|
52
40
|
const labelAnnotationObject = obj.annotations?.find((annotation) => annotation.predicate ===
|