ExarcaFidalgo / Shumlex

Integración ShEx - UML
MIT License
4 stars 0 forks source link

Correcciones del grafo #62

Closed ExarcaFidalgo closed 4 years ago

ExarcaFidalgo commented 4 years ago

ShEx básico

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { :name xsd:string; :age xsd:int ?; :gender [:Male :Female]; :knows @:User ; :worksFor @:Company ; :buys @<Product> {1,10}; }

:Ultrauser { a [:User]; }

:Titanuser @:User AND { :titancode xsd:string; }

:Company { :name xsd:string ; :hasEmployee @:User *; :possess @<Product> {5,} }

<Product> { :name .; :sku xsd:boolean ; :manufacturer @<Organization> + }

<Organization> { :name xsd:string ; :isPartOf @<Organization> ?; :hasDirectives @:User {5} }

imagen

ExarcaFidalgo commented 4 years ago

Herencia

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { :name xsd:string; :age xsd:int ?; }

:Ultrauser { a [:User]; }

:Titanuser @:User AND { :titancode xsd:string; }

:VIPUser EXTRA a { a @:User; }

imagen

Si deseamos ser coherentes con el UML, Titanuser debería tener una relación AND a un hijo vacío, cuya shape {titancode... } fuera a su vez su hijo. ARREGLADO

imagen

ExarcaFidalgo commented 4 years ago

Restricciones de tipo nodal

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User IRI { :name xsd:string; }

:Ultrauser Literal AND { a [:User]; }

:Titanuser @:User AND NonLiteral AND { }

<Product> BNode AND { }

<AThing> IRI

imagen

Al igual que el anterior, habría que expresar ese AND con { }:

imagen

ExarcaFidalgo commented 4 years ago

Facetas

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { :name xsd:string /[a-z]+/; :age xsd:int MinInclusive 18 ?; :c xsd:int TotalDigits 3; :d xsd:int FractionDigits 4; :e xsd:string Length 6; :f xsd:string MinLength 3; :g xsd:string MaxLength 15; }

imagen

ExarcaFidalgo commented 4 years ago

Rangos y exclusiones

prefix : https://schema.org/ prefix codes: http://example.codes/ base http://example.org/

:Product { :status [codes:~ - codes:unknown - codes:bad.~ "111" ]; :phone ["+34"~ - "+3468031" - "+3467182"~ ]; :quantity [99~ - 9987 - 991~ ]; :url [codes:Personal~ ]; }

imagen

ExarcaFidalgo commented 4 years ago

Conjuntos genéricos

prefix codes: http://example.codes/

prefix : http://schema.org/ base http://example.org/

:Product { :status [. - codes:bad ]; :name [. - "Trademark" ]; :price [. - 66 ]; }

imagen

ExarcaFidalgo commented 4 years ago

Etiquetas de lenguaje

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:FrenchProduct { :frlabel [@fr ]; }

:EnglishProduct { :enlabel [@en~ ]; }

:SpanishProduct { :splabel [@es~ - @es-AR - @es-ES ]; }

:AnyProduct { :label [. - @kz ]; }

imagen

ExarcaFidalgo commented 4 years ago

Cardinalidad

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { :name xsd:string; ( :givenName xsd:string; :familyName xsd:string; ) ? ; ( :has @<Something> {2,}; :c xsd:string; ) * ; :owns @:Garage; }

:Garage { ( <AE86> xsd:string; ( <Levin> xsd:string; <Cilinders> xsd:int; ) ? ; ( <Trueno> xsd:string; <Cilinders> xsd:int; ) ? ; ) + ; }

<Something> { }

imagen

ExarcaFidalgo commented 4 years ago

OneOf

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { :name xsd:string; | ( :givenName xsd:string +; :familyName xsd:string; ); }

:Car { :model xsd:string; ( :turbo xsd:string; | :misfiring xsd:string; | :atm xsd:string;) {1,2}; }

imagen

ExarcaFidalgo commented 4 years ago

Shapes anidadas

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:Car { :name xsd:string; :belongs @_:1; }

:Garage { }

:User { :name xsd:string; :worksFor { a [:Company]; }; }

:Company { }

:GreatGrandson { :parent { :parent { :parent . +; }; }; }

_:1 { a [:Garage]; }

imagen

ExarcaFidalgo commented 4 years ago

Shapes cerradas

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User IRI CLOSED { :name xsd:string MaxLength 3; :age xsd:int ?; :gender [:Male :Female ]; :knows @:User; }

:Company CLOSED { :name xsd:string; }

imagen

Con el nuevo AND: imagen

ExarcaFidalgo commented 4 years ago

Restricción triple inversa

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:Person { }

:User { ^a [:Person]; ^:name xsd:string; ^:gender [:Male :Female ]; }

:Company { ^:worksFor @:User +; }

imagen

ExarcaFidalgo commented 4 years ago

Extra

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:FollowSpaniards EXTRA :follows { :follows { :nationality [:Spain ]; } +; }

imagen

ExarcaFidalgo commented 4 years ago

Expresiones etiquetadas

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { $:name ( :name .; | ( :givenName .; :familyName .; );) ; :email IRI; }

:Employee { &:name; :employeeId .; }

imagen

ExarcaFidalgo commented 4 years ago

Conjunciones

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { :name xsd:string; :owns IRI; } AND { :owns @:Product; }

:Titanuser @:User AND { :titancode xsd:string; } AND { :owns Literal; }

:Ultrauser Literal AND { a [:User]; }

:Product { :productId xsd:string MinLength 5 AND MaxLength 10; }

imagen

Con el nuevo AND:

imagen

ExarcaFidalgo commented 4 years ago

Disyunciones

prefix : https://schema.org/ prefix xsd: http://www.w3.org/2001/XMLSchema# base http://example.org/

:User { :name xsd:string; :owns IRI; } OR { :owns @:Product; }

:Titanuser @:User OR { :titancode xsd:string; } OR { :owns Literal; }

:Product { :productId xsd:string OR MinLength 5 OR MaxLength 10; }

imagen

ExarcaFidalgo commented 4 years ago

Actualizado y cerrado.