start to implement shapeOr

main
Laurin Weger 2 weeks ago
parent cc225bcde7
commit 78fd23d719
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 4
      src/shapes/ldo/catShape.schema.compact.ts
  2. 4
      src/shapes/ldo/personShape.schema.compact.ts
  3. 15
      src/shapes/ldo/testShape.schema.compact.ts
  4. 4
      src/shapes/ldo/testShape.typings.ts
  5. 6
      src/shapes/shex/testShape.shex

@ -7,7 +7,7 @@ import type { CompactSchema } from "@ldo/ldo";
*/ */
export const catShapeSchema: CompactSchema = { export const catShapeSchema: CompactSchema = {
"http://example.org/Cat": { "http://example.org/Cat": {
schemaUri: "http://example.org/Cat", iri: "http://example.org/Cat",
predicates: [ predicates: [
{ {
type: "literal", type: "literal",
@ -49,7 +49,7 @@ export const catShapeSchema: CompactSchema = {
], ],
}, },
"http://example.org/Cat::http://example.org/address": { "http://example.org/Cat::http://example.org/address": {
schemaUri: "http://example.org/Cat::http://example.org/address", iri: "http://example.org/Cat::http://example.org/address",
predicates: [ predicates: [
{ {
type: "string", type: "string",

@ -7,7 +7,7 @@ import type { CompactSchema } from "@ldo/ldo";
*/ */
export const personShapeSchema: CompactSchema = { export const personShapeSchema: CompactSchema = {
"http://example.org/Person": { "http://example.org/Person": {
schemaUri: "http://example.org/Person", iri: "http://example.org/Person",
predicates: [ predicates: [
{ {
type: "literal", type: "literal",
@ -49,7 +49,7 @@ export const personShapeSchema: CompactSchema = {
], ],
}, },
"http://example.org/Person::http://example.org/address": { "http://example.org/Person::http://example.org/address": {
schemaUri: "http://example.org/Person::http://example.org/address", iri: "http://example.org/Person::http://example.org/address",
predicates: [ predicates: [
{ {
type: "string", type: "string",

@ -7,7 +7,7 @@ import type { CompactSchema } from "@ldo/ldo";
*/ */
export const testShapeSchema: CompactSchema = { export const testShapeSchema: CompactSchema = {
"http://example.org/TestObject": { "http://example.org/TestObject": {
schemaUri: "http://example.org/TestObject", iri: "http://example.org/TestObject",
predicates: [ predicates: [
{ {
type: "literal", type: "literal",
@ -16,6 +16,7 @@ export const testShapeSchema: CompactSchema = {
minCardinality: 1, minCardinality: 1,
predicateUri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", predicateUri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
readablePredicate: "type", readablePredicate: "type",
extra: true,
}, },
{ {
type: "string", type: "string",
@ -63,10 +64,17 @@ export const testShapeSchema: CompactSchema = {
predicateUri: "http://example.org/anotherObject", predicateUri: "http://example.org/anotherObject",
readablePredicate: "anotherObject", readablePredicate: "anotherObject",
}, },
{
type: "string",
maxCardinality: 1,
minCardinality: 1,
predicateUri: "http://example.org/numOrStr",
readablePredicate: "numOrStr",
},
], ],
}, },
"http://example.org/TestObject::http://example.org/objectValue": { "http://example.org/TestObject::http://example.org/objectValue": {
schemaUri: "http://example.org/TestObject::http://example.org/objectValue", iri: "http://example.org/TestObject::http://example.org/objectValue",
predicates: [ predicates: [
{ {
type: "string", type: "string",
@ -92,8 +100,7 @@ export const testShapeSchema: CompactSchema = {
], ],
}, },
"http://example.org/TestObject::http://example.org/anotherObject": { "http://example.org/TestObject::http://example.org/anotherObject": {
schemaUri: iri: "http://example.org/TestObject::http://example.org/anotherObject",
"http://example.org/TestObject::http://example.org/anotherObject",
predicates: [ predicates: [
{ {
type: "string", type: "string",

@ -66,4 +66,8 @@ export interface TestObject {
prop2: number; prop2: number;
} }
>; >;
/**
* Original IRI: http://example.org/numOrStr
*/
numOrStr: string;
} }

@ -1,7 +1,7 @@
PREFIX ex: <http://example.org/> PREFIX ex: <http://example.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
ex:TestObject { ex:TestObject EXTRA a {
a ["TestObject"] ; a ["TestObject"] ;
ex:stringValue xsd:string ; ex:stringValue xsd:string ;
ex:numValue xsd:integer ; ex:numValue xsd:integer ;
@ -14,6 +14,8 @@ ex:TestObject {
} ; } ;
ex:anotherObject { ex:anotherObject {
ex:prop1 xsd:string; ex:prop1 xsd:string;
ex:prop2 xsd:integer ex:prop2 xsd:integer ;
} * ; } * ;
ex:numOrStr xsd:string;
# TODO: ShapeOr -- | ex:numOrStr xsd:integer
} }

Loading…
Cancel
Save