geneontology / go-shapes

Schema for Gene Ontology Causal Activity Models defined using RDF Shapes
2 stars 0 forks source link

shex to json #128

Open tmushayahama opened 4 years ago

tmushayahama commented 4 years ago

I was looking at this shex.js repo

Is there a shex to json converter? This would be awesome. The main use case is for Noctua Form to chunk the model. The four main chunks are

Since the beginnings, Noctua Form uses a static json like, but cannot handle anymore :( .

image

Even if it is manual converter

balhoff commented 4 years ago

@tmushayahama do you need to convert the ShEx to JSON to use it? Or instead should you use the API/data model provided by Shex.js?

goodb commented 4 years ago

@tmushayahama here is the current schema in shex json format. If this is useful to you, we can add the conversion from our default shexc to shexj as part of the build process here. It would be pretty cool if the forms were generated directly from this document.

{
  "@context" : "http://www.w3.org/ns/shex.jsonld",
  "type" : "Schema",
  "shapes" : [ {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntityClass"
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"a molecular entity (a gene product, chemical, or complex typically)\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/InformationBiomacromoleculeClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/CHEBI_33695" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/ProvenanceAnnotated",
    "type" : "Shape",
    "expression" : {
      "type" : "EachOf",
      "expressions" : [ {
        "type" : "TripleConstraint",
        "predicate" : "http://purl.org/dc/elements/1.1/contributor",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "datatype" : "http://www.w3.org/2001/XMLSchema#string"
        },
        "min" : 0,
        "max" : -1
      }, {
        "type" : "TripleConstraint",
        "predicate" : "http://purl.org/dc/elements/1.1/date",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "datatype" : "http://www.w3.org/2001/XMLSchema#string"
        },
        "min" : 0,
        "max" : -1
      }, {
        "type" : "TripleConstraint",
        "predicate" : "http://purl.org/pav/providedBy",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "datatype" : "http://www.w3.org/2001/XMLSchema#string"
        },
        "min" : 0,
        "max" : -1
      }, {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "datatype" : "http://www.w3.org/2001/XMLSchema#string"
        },
        "min" : 0,
        "max" : -1
      } ]
    }
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/InformationBiomacromolecule",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/InformationBiomacromoleculeClass"
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0001025",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponent",
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/BFO_0000050",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplex",
          "min" : 0,
          "max" : 1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"an information biomacromolecule - e.g. a protein or RNA product\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/EvidenceClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/ECO_0000000" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/MolecularFunctionClass", "http://purl.obolibrary.org/obo/go/shapes/NegatedMolecularFunctionClass" ]
          },
          "min" : 1,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002333",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/InformationBiomacromolecule", "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplex" ]
          },
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/BFO_0000050",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/BFO_0000066",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity", "http://purl.obolibrary.org/obo/go/shapes/CellularComponent" ]
          },
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002234",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity", "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplex" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002233",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity", "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplex" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002413",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002211",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002212",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002213",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002578",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002630",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002406",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002418",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0004046",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0004047",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002411",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess", "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002305",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess", "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002304",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess", "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002092",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalPhase", "http://purl.obolibrary.org/obo/go/shapes/LifeCycleStage", "http://purl.obolibrary.org/obo/go/shapes/PlantStructureDevelopmentStage" ]
          },
          "min" : 0,
          "max" : -1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"A molecular function\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntityClass", "http://purl.obolibrary.org/obo/go/shapes/NegatedAnatomicalEntityClass" ]
          }
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/BFO_0000050",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity",
          "min" : 0,
          "max" : 1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"an anatomical entity\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplex",
    "type" : "Shape",
    "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
    "expression" : {
      "type" : "EachOf",
      "expressions" : [ {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplexClass"
      }, {
        "type" : "TripleConstraint",
        "predicate" : "http://purl.obolibrary.org/obo/RO_0001025",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponent",
        "min" : 0,
        "max" : 1
      }, {
        "type" : "TripleConstraint",
        "predicate" : "http://purl.obolibrary.org/obo/BFO_0000051",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/InformationBiomacromolecule",
        "min" : 0,
        "max" : -1
      } ]
    },
    "annotations" : [ {
      "type" : "Annotation",
      "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
      "object" : {
        "value" : "\"a protein complex\""
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/LifeCycleStage",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/LifeCycleStageClass"
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"a lifecycle stage\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/NegatedBiologicalProcessClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "bnode"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2002/07/owl#complementOf",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcessClass"
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/ProteinClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/CHEBI_36080" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/MacromolecularMachine",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeOr",
      "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/Protein", "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplex" ]
    }, {
      "type" : "Shape"
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunctionClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/GO_0003674" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcessClass", "http://purl.obolibrary.org/obo/go/shapes/NegatedBiologicalProcessClass" ]
          },
          "min" : 1,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/BFO_0000050",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002233",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity", "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002234",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity", "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/BFO_0000066",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity", "http://purl.obolibrary.org/obo/go/shapes/CellularComponent" ]
          },
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002313",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/InformationBiomacromolecule",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002339",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponent",
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002338",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponent",
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002411",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess", "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002305",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess", "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002304",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess", "http://purl.obolibrary.org/obo/go/shapes/MolecularFunction" ]
          },
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002211",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002212",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002213",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcess",
          "min" : 0,
          "max" : -1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"A biological process\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalPhaseClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/GO_0044848" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/PlantStructureDevelopmentStage",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/PlantStructureDevelopmentStageClass"
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"a plant structure developmental stage\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/ProvenanceAnnotated" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : {
            "type" : "NodeConstraint",
            "values" : [ "http://www.w3.org/2002/07/owl#NamedIndividual" ]
          },
          "annotations" : [ {
            "type" : "Annotation",
            "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
            "object" : {
              "value" : "\"Every entity we care about is a named individual\""
            }
          } ],
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://www.geneontology.org/formats/oboInOwl#hasDbXref",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/2000/01/rdf-schema#label",
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/2004/02/skos/core#exactMatch",
          "min" : 0,
          "max" : -1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"Default allowable metadata for GO-CAM entities\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponentClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/GO_0005575" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalProcessClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/GO_0008150" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntityClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/CARO_0000000" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/NegatedMolecularFunctionClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "bnode"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2002/07/owl#complementOf",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/MolecularFunctionClass"
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/PlantStructureDevelopmentStageClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/PO_0009012" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/ProteinContainingComplexClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/GO_0032991" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/NegatedAnatomicalEntityClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "bnode"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2002/07/owl#complementOf",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntityClass"
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/OwlClass",
    "type" : "Shape",
    "expression" : {
      "type" : "TripleConstraint",
      "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
      "valueExpr" : {
        "type" : "NodeConstraint",
        "values" : [ "http://www.w3.org/2002/07/owl#Class" ]
      },
      "min" : 1,
      "max" : 1
    }
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalPhase",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/BiologicalPhaseClass"
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"a biological phase\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponent",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : {
            "type" : "ShapeOr",
            "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/CellularComponentClass", "http://purl.obolibrary.org/obo/go/shapes/NegatedCellularComponentClass" ]
          },
          "min" : 1,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/BFO_0000050",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity",
          "min" : 0,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002220",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity",
          "min" : 0,
          "max" : -1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0002131",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/AnatomicalEntity",
          "min" : 0,
          "max" : -1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"a cellular component\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/Evidence",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/EvidenceClass",
          "min" : 1,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.org/dc/elements/1.1/source",
          "valueExpr" : {
            "type" : "NodeConstraint",
            "datatype" : "http://www.w3.org/2001/XMLSchema#string"
          },
          "min" : 1,
          "max" : 1
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://geneontology.org/lego/evidence-with",
          "valueExpr" : {
            "type" : "NodeConstraint",
            "datatype" : "http://www.w3.org/2001/XMLSchema#string"
          },
          "min" : 0,
          "max" : 1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"A kind of evidence\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/AnnotatedEdge",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "bnode"
      }, "http://purl.obolibrary.org/obo/go/shapes/ProvenanceAnnotated" ]
    }, {
      "type" : "Shape",
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : {
            "type" : "NodeConstraint",
            "values" : [ "http://www.w3.org/2002/07/owl#Axiom" ]
          }
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/2002/07/owl#annotatedSource",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity"
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/2002/07/owl#annotatedProperty",
          "valueExpr" : {
            "type" : "NodeConstraint",
            "nodeKind" : "iri"
          }
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/2002/07/owl#annotatedTarget",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/GoCamEntity"
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://geneontology.org/lego/evidence",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/Evidence",
          "min" : 0,
          "max" : -1
        } ]
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/LifeCycleStageClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/UBERON_0000105" ]
        }
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/Gene",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity", {
      "type" : "Shape",
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://purl.obolibrary.org/obo/RO_0001025",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponent",
        "min" : 0,
        "max" : 1
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"a gene (a piece of DNA with a purpose)\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/NegatedCellularComponentClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "bnode"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2002/07/owl#complementOf",
        "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponentClass"
      }
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/Protein",
    "type" : "ShapeAnd",
    "shapeExprs" : [ "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntity", {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" ],
      "expression" : {
        "type" : "EachOf",
        "expressions" : [ {
          "type" : "TripleConstraint",
          "predicate" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/ProteinClass"
        }, {
          "type" : "TripleConstraint",
          "predicate" : "http://purl.obolibrary.org/obo/RO_0001025",
          "valueExpr" : "http://purl.obolibrary.org/obo/go/shapes/CellularComponent",
          "min" : 0,
          "max" : 1
        } ]
      },
      "annotations" : [ {
        "type" : "Annotation",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#comment",
        "object" : {
          "value" : "\"a protein\""
        }
      } ]
    } ]
  }, {
    "id" : "http://purl.obolibrary.org/obo/go/shapes/ChemicalEntityClass",
    "type" : "ShapeAnd",
    "shapeExprs" : [ {
      "type" : "ShapeAnd",
      "shapeExprs" : [ {
        "type" : "NodeConstraint",
        "nodeKind" : "iri"
      }, "http://purl.obolibrary.org/obo/go/shapes/OwlClass" ]
    }, {
      "type" : "Shape",
      "extra" : [ "http://www.w3.org/2000/01/rdf-schema#subClassOf" ],
      "expression" : {
        "type" : "TripleConstraint",
        "predicate" : "http://www.w3.org/2000/01/rdf-schema#subClassOf",
        "valueExpr" : {
          "type" : "NodeConstraint",
          "values" : [ "http://purl.obolibrary.org/obo/CHEBI_24431" ]
        }
      }
    } ]
  } ]
}
goodb commented 4 years ago

@tmushayahama if you start working with this, let me know. Assuming you want the json representation, we will want to establish a way for you to generate it from the shexc representation we use here in the project - so that you can keep up to date.

tmushayahama commented 4 years ago

@goodb I totally forgot to respond on the earlier. Thank you for that schema, I am already using the idea of the schema representation found here in Noctua Form https://github.com/geneontology/noctua-form-base/blob/master/src/%40noctua.form/data/config/insert-entity-definition.ts . In that config folder you can also see I used it to define combined units like bp only, cc only and activity unit

image

It is actually more of the same structure. Few exception are

But yes, this would be cool if generated because now the form is now very dynamic. Using cardinality, Noctua Form can even determine what you can insert as your object by looking at subject and its triples and possible future triples (predicate and object combination). like below All this I used the json example idea.

image

However the only catch will be I am using the same schema for autocomplete. i.e. instead of CARO, it is autocompleting on CL:000003 and UBERON: xxx @vanaukenk can explain on this part.

Thanx for the update comment

ericprud commented 4 years ago

Y'all may have already run across these ways to change ShExC to ShExJ:

shex-simple webapp

Load a schema, make sure the Query Map is empty, hit [Validate]

shex-cli node module

There's a command-line node script you can install or run via npx.

shex-to-json foo.shex # parse ShExC to ShExJ and send to stdout
echo "<S1> { <p> . }" | shex-to-json - # - to read from stdin

no install

echo "<S1> { <p> . }" | npx -p @shexjs/cli -p @shexjs/parser shex-to-json -

local install

Make a directory and use npm to install the script:

cd $_ &&
npm init -y > /dev/null &&
npm install @shexjs/{cli,parser} > /dev/null && 
echo "<S1> { <p> . }" | ./node_modules/.bin/shex-to-json -

This leaves you with something you can run quickly without hitting the network.

global install

Install the script "globally", meaning it gets installed in the user's path (assuming proper/lucky npm installation).

npm install -g @shexjs/{cli,parser} > /dev/null && echo "<S1> { <p> . }" | shex-to-json -

The default linux npm package installation may require you to sudo to write into /usr/lib. Node wisdom says that you should only install -g (globally) if you're installing a command-line script, as in this case. It's safe to experiment because you can always

npm uninstall -g @shexjs/{cli,parser}

If you ever wonder how much global cruft you've accumulated, you can

npm list -g --depth 0

Stability

ShExJ is very stable and the CG has a commitment to maintain backward compatibility. The script is dead-simple and shouldn't change. The package will change the next time I publish. After that, you won't need to include @shexjs/parser (which should have been listed as a dependency already).

vanaukenk commented 3 years ago

@tmushayahama

Should we leave this ticket open?