parent
45452a32a0
commit
74e527f998
@ -0,0 +1,27 @@ |
|||||||
|
import type { ObjectLiteral, valueSetValue } from "shexj"; |
||||||
|
|
||||||
|
export function hashValueSetValue(vsv: valueSetValue) { |
||||||
|
if (typeof vsv === "string") return `string|${vsv}`; |
||||||
|
|
||||||
|
const vsvol = vsv as ObjectLiteral; |
||||||
|
if (vsvol.value) return `objectLiteral|${vsvol.value}|${vsvol.language}`; |
||||||
|
|
||||||
|
const vsvnol = vsv as Exclude<valueSetValue, ObjectLiteral | string>; |
||||||
|
|
||||||
|
switch (vsvnol.type) { |
||||||
|
case "IriStem": |
||||||
|
return `IriStem|${vsvnol.stem}`; |
||||||
|
case "IriStemRange": |
||||||
|
return `IriStemRange|${vsvnol.stem}|${vsvnol.exclusions}`; |
||||||
|
case "LiteralStem": |
||||||
|
return `LiteralStem|${vsvnol.stem}`; |
||||||
|
case "LiteralStemRange": |
||||||
|
return `LiteralStemRange|${vsvnol.stem}|${vsvnol.exclusions}`; |
||||||
|
case "Language": |
||||||
|
return `Language|${vsvnol.languageTag}`; |
||||||
|
case "LanguageStem": |
||||||
|
return `LanguageStem|${vsvnol.stem}`; |
||||||
|
case "LanguageStemRange": |
||||||
|
return `LanguageStemRange|${vsvnol.stem}|${vsvnol.exclusions}`; |
||||||
|
} |
||||||
|
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,60 @@ |
|||||||
|
import type { TestData } from "./testData.js"; |
||||||
|
|
||||||
|
/** |
||||||
|
* MULTIPLE CONSTRAINTS |
||||||
|
*/ |
||||||
|
export const multipleSharedPredicates: TestData = { |
||||||
|
name: "multipleSharedPredicates", |
||||||
|
shexc: ` |
||||||
|
PREFIX ex: <https://example.com/> |
||||||
|
|
||||||
|
ex:MediaContainerShape { |
||||||
|
a [ ex:Media ]; |
||||||
|
a [ ex:Video ]; |
||||||
|
ex:something [ ex:OtherThing ]; |
||||||
|
ex:something [ ex:Thing3 ]; |
||||||
|
} |
||||||
|
`,
|
||||||
|
sampleTurtle: "", |
||||||
|
baseNode: "", |
||||||
|
successfulContext: { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
Media: { |
||||||
|
"@id": "https://example.com/Media", |
||||||
|
"@context": { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
something: { |
||||||
|
"@id": "https://example.com/something", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
}, |
||||||
|
}, |
||||||
|
Video: { |
||||||
|
"@id": "https://example.com/Video", |
||||||
|
"@context": { |
||||||
|
type: { |
||||||
|
"@id": "@type", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
something: { |
||||||
|
"@id": "https://example.com/something", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
}, |
||||||
|
}, |
||||||
|
something: { |
||||||
|
"@id": "https://example.com/something", |
||||||
|
"@isCollection": true, |
||||||
|
}, |
||||||
|
OtherThing: "https://example.com/OtherThing", |
||||||
|
Thing3: "https://example.com/Thing3", |
||||||
|
}, |
||||||
|
successfulTypings: |
||||||
|
'import { LdSet, LdoJsonldContext } from "@ldo/ldo"\n\nexport interface MediaContainerShape {\n "@id"?: string;\n "@context"?: LdoJsonldContext;\n type: LdSet<{\n "@id": "Media";\n } | {\n "@id": "Video";\n }>;\n something: LdSet<{\n "@id": "OtherThing";\n } | {\n "@id": "Thing3";\n }>;\n}\n\n', |
||||||
|
}; |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue