Open danbri opened 2 years ago
See also:
In the shex validator (not schemarama, to be clear, but the tinyurl in prev. entry in this issue), ... remove the querymap section, make sure there's still something to validate, and when you validate there will be shexj at the bottom of the page:
https://gist.github.com/danbri/1ae3afdad3f7a82177376eafc113d6eb
@ericprud adds that behind the scenes the flow is more like:
ShExR and ShexJ -> ShExC, ShExC -> ShExJ
In raw form we get this:
{
"type": "Schema",
"shapes": [
{
"type": "ShapeAnd",
"id": "http://shex.io/webapps/shex.js/doc/S1",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/url",
"min": 1,
"max": -1,
"semActs": [
{
"type": "SemAct",
"name": "https://google.com/search/validation/validurl",
"code": "console.log('some url checking code here')"
}
]
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/datePublished",
"min": 0,
"max": 1,
"semActs": [
{
"type": "SemAct",
"name": "https://google.com/search/validation/validdate-time",
"code": "console.log('some datetime checking code here')"
}
]
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/claimReviewed"
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/itemReviewed",
"valueExpr": {
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/CreativeWork"
]
}
}
},
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/CreativeWork"
]
}
}
}
},
{
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/author",
"valueExpr": {
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Organization"
]
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Person"
]
}
}
}
]
},
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "ShapeOr",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Organization"
]
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Person"
]
}
}
}
]
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/name",
"min": 0,
"max": 1
}
}
]
}
]
},
"min": 0,
"max": 1
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/datePublished",
"min": 0,
"max": 1,
"semActs": [
{
"type": "SemAct",
"name": "https://google.com/search/validation/validdate-time",
"code": "console.log('some datetime checking code here')"
}
]
}
}
]
}
]
}
]
},
"min": 0,
"max": 1
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/author",
"valueExpr": {
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Organization"
]
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Person"
]
}
}
}
]
},
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "ShapeOr",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Organization"
]
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Person"
]
}
}
}
]
}
},
{
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/name"
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/url"
}
}
]
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/url",
"min": 0,
"max": -1,
"semActs": [
{
"type": "SemAct",
"name": "https://google.com/search/validation/validurl",
"code": "console.log('some url checking code here')"
}
]
}
}
]
}
]
}
]
},
"min": 0,
"max": 1
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/reviewRating",
"valueExpr": {
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Rating"
]
}
}
},
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"valueExpr": {
"type": "NodeConstraint",
"values": [
"http://schema.org/Rating"
]
}
}
}
},
{
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/alternateName"
}
},
{
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/name"
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/alternateName",
"min": 0,
"max": 1
}
}
]
},
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "ShapeNot",
"shapeExpr": {
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/name"
}
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/alternateName",
"min": 1,
"max": -1
}
}
]
}
]
},
{
"type": "ShapeNot",
"shapeExpr": {
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/alternateName"
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/name"
}
}
]
}
},
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/ratingValue"
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/bestRating"
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/worstRating"
}
}
]
},
{
"type": "ShapeNot",
"shapeExpr": {
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/ratingValue",
"valueExpr": {
"type": "NodeConstraint",
"pattern": "-1"
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/bestRating",
"valueExpr": {
"type": "NodeConstraint",
"pattern": "-1"
}
}
},
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/worstRating",
"valueExpr": {
"type": "NodeConstraint",
"pattern": "-1"
}
}
}
]
}
}
]
}
},
{
"type": "ShapeAnd",
"shapeExprs": [
{
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/ratingValue",
"valueExpr": {
"type": "ShapeOr",
"shapeExprs": [
{
"type": "NodeConstraint",
"pattern": "([0-9]+[\\.,]?[0-9]*)/([0-9]+[\\.,]?[0-9]*)"
},
{
"type": "NodeConstraint",
"pattern": "([0-9]+[\\.,]?[0-9]*)%"
},
{
"type": "NodeConstraint",
"pattern": "([0-9]+[\\.,]?[0-9]*)"
}
]
},
"min": 1,
"max": -1
}
},
{
"type": "ShapeOr",
"shapeExprs": [
{
"type": "ShapeNot",
"shapeExpr": {
"type": "Shape",
"expression": {
"type": "TripleConstraint",
"predicate": "http://schema.org/ratingValue",
"valueExpr": {
"type": "NodeConstraint",
"pattern": "([0-9]+[\\.,]?[0-9]*)"
},
"min": 1,
"max": -1
}
}
},
{
"type": "Shape",
"semActs": [
{
"type": "SemAct",
"name": "https://google.com/search/validation/validrating"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
"min": 1,
"max": -1
}
}
]
}
],
"@context": "http://www.w3.org/ns/shex.jsonld"
}
At Google we're looking into publishing .ttl but the JS tools here need ShEx in JSON(-LD) form.
I believe everything is in the shexjs codebase as exposed at http://shex.io/webapps/shex.js/doc/shex-simple.html somewhere, @ericprud is considering API possibilities.