Skip to content

Commit

Permalink
Building blocks postprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-metalinkage committed Nov 20, 2024
1 parent 2335b49 commit 91d76be
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 54 deletions.
8 changes: 4 additions & 4 deletions build/bblocks.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"name": "Building Blocks - JSON schema for W3C PROV model",
"abstract": "Defines a standardised JSON schema for PROV ontology elements - supporting a graph structure based on an array of objects implementing PROV defined classes with object cross references.",
"description": "Provenance defined using the [W3C PROV-O model](https://www.w3.org/TR/prov-o/) is a DAG (non-cyclic graph) based on three main object types: Entity, Activity and Agent.\n\nThis repository defines a JSON schema and matching JSON-LD context for this model, using the canonical terminology used in the PROV ontology as element names.\n\nIt also defines a context for an optional schema property \"has_provenance\" that can be used to wrap a provenance graph as an array of such objects, to extend the property prov:wasGeneratedBy (whose range is one or more Entity objects) with an explicit schema.\n\n![](https://www.w3.org/TR/prov-o/diagrams/starting-points.svg)\n",
"modified": "2024-11-18T11:05:29.832215",
"modified": "2024-11-20T21:00:18.964576",
"tooling": {
"bblocks-postprocess": {
"commitId": "\"92755a131115293631118b409fa11027d18f8fa3",
Expand Down Expand Up @@ -137,7 +137,7 @@
"itemClass": "schema",
"register": "ogc-utils",
"version": "0.1",
"dateOfLastChange": "2024-11-18",
"dateOfLastChange": "2024-11-20",
"sources": [
{
"link": "https://www.w3.org/TR/prov-o/",
Expand All @@ -152,8 +152,8 @@
],
"shaclRules": {},
"dependsOn": [
"ogc.ogc-utils.iri-or-curie",
"ogc.ogc-utils.json-link"
"ogc.ogc-utils.json-link",
"ogc.ogc-utils.iri-or-curie"
],
"ldContext": "https://ogcincubator.github.io/bblock-prov-schema/build/annotated/ogc-utils/prov/context.jsonld",
"schema": {
Expand Down
16 changes: 8 additions & 8 deletions build/bblocks.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
rdfs:label "Provenance Chain" ;
dct:abstract "Schema for a provenance chain based on PROV vocabulary semantics, Agents, Activities and Entities. This schema is designed as a mix-in that can be used to add properties to other objects in a polymorphic way." ;
dct:created "2023-07-10T00:00:00+00:00"^^xsd:dateTime ;
dct:description [ dct:format "text/html" ;
dct:description [ dct:format "application/json" ;
rdfs:isDefinedBy "https://ogcincubator.github.io/bblock-prov-schema/build/generateddocs/json-full/ogc-utils/prov/index.json" ],
[ dct:format "text/html" ;
rdfs:isDefinedBy "https://ogcincubator.github.io/bblock-prov-schema/bblock/ogc.ogc-utils.prov" ],
[ dct:format "text/markdown" ;
rdfs:isDefinedBy "https://ogcincubator.github.io/bblock-prov-schema/build/generateddocs/markdown/ogc-utils/prov/index.md" ],
[ dct:format "application/json" ;
rdfs:isDefinedBy "https://ogcincubator.github.io/bblock-prov-schema/build/generateddocs/json-full/ogc-utils/prov/index.json" ] ;
rdfs:isDefinedBy "https://ogcincubator.github.io/bblock-prov-schema/build/generateddocs/markdown/ogc-utils/prov/index.md" ] ;
dct:hasVersion "0.1" ;
dct:modified "2024-11-18"^^xsd:date ;
dct:modified "2024-11-20"^^xsd:date ;
dct:source <https://www.w3.org/TR/prov-o/> ;
skos:inScheme <https://ogcincubator.github.io/bblock-prov-schema/> ;
dcat:keyword "prov",
Expand Down Expand Up @@ -53,11 +53,11 @@ It also defines a context for an optional schema property "has_provenance" that
<https://www.w3.org/TR/prov-o/> rdfs:label "The PROV-O vocabulary" .

[] a prov:Activity ;
prov:endedAtTime "2024-11-18T11:05:31.159497"^^xsd:dateTime ;
prov:startedAtTime "2024-11-18T11:05:31.097752"^^xsd:dateTime ;
prov:endedAtTime "2024-11-20T21:00:20.254068"^^xsd:dateTime ;
prov:startedAtTime "2024-11-20T21:00:20.190903"^^xsd:dateTime ;
prov:used [ a prov:Entity ;
dct:format "application/json" ;
dct:hasVersion "git:2bd57a60d1b7fddef0ce927350df2f4c0d42448a" ;
dct:hasVersion "git:2335b49b153003b84958996572e5063e08431adf" ;
rdfs:seeAlso <https://ogcincubator.github.io/bblock-prov-schema/build/register.json> ],
[ a prov:Entity ;
dct:format "application/yaml" ;
Expand Down
12 changes: 6 additions & 6 deletions build/generateddocs/json-full/ogc-utils/prov/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"itemClass": "schema",
"register": "ogc-utils",
"version": "0.1",
"dateOfLastChange": "2024-11-18",
"dateOfLastChange": "2024-11-20",
"sources": [
{
"link": "https://www.w3.org/TR/prov-o/",
Expand All @@ -24,8 +24,8 @@
],
"shaclRules": {},
"dependsOn": [
"ogc.ogc-utils.iri-or-curie",
"ogc.ogc-utils.json-link"
"ogc.ogc-utils.json-link",
"ogc.ogc-utils.iri-or-curie"
],
"ldContext": "https://ogcincubator.github.io/bblock-prov-schema/build/annotated/ogc-utils/prov/context.jsonld",
"schema": {
Expand Down Expand Up @@ -139,17 +139,17 @@
"language": "json",
"ref": "examples/example-llm.json",
"base-uri": "http://www.example.com/exampleEntity/",
"code": "{\n \"prov:type\": \"prov:Activity\",\n \"generated\": {\n \"id\": \"output\",\n \"type\": \"Entity\",\n \"response\": \"\\u001b[0mLLM Generated Code: \\u001b[96mgdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()\\n\\u001b[0mRaw Response: \\u001b[96m511.8048618048641\\n\\u001b[0mResponse:\\u001b[92mThe closest hospital to UNSW Village is approximately 512 meters away.\"\n },\n \"endedAtTime\": \"2024-11-18T06:44:33.504798Z\",\n \"used\": [\n {\n \"id\": \"file\",\n \"type\": \"Entity\",\n \"data\": [\n {\n \"id\": \"osmdata.shp\",\n \"type\": \"Entity\",\n \"records\": 3544\n }\n ]\n },\n {\n \"id\": \"user_input\",\n \"type\": \"Entity\",\n \"input\": \"How far away is the closest hospital from UNSW village\"\n }\n ]\n}",
"code": "{\n \"prov:type\": \"prov:Activity\",\n \"generated\": {\n \"id\": \"output\",\n \"type\": \"Entity\",\n \"AgentType\": \"SoftwareAgent\",\n \"response\": [\n {\n \"id\": \"LLM Generated Code\",\n \"type\": \"Entity\",\n \"wasGeneratedBy\": \"gemini-1.5-pro-001\",\n \"data\": \"gdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()\"\n },\n {\n \"id\": \"Code Output\",\n \"type\": \"Entity\",\n \"data\": \"511.8048618048641\"\n },\n {\n \"id\": \"Final Output\",\n \"type\": \"Entity\",\n \"wasGeneratedBy\": \"gemini-1.5-flash-001\",\n \"data\": \"The closest hospital to UNSW Village is approximately 512 meters away.\"\n }\n ]\n },\n \"startedAtTime\": \"2024-11-19T05:07:22.927913Z\",\n \"endedAtTime\": \"2024-11-19T05:07:34.304708Z\",\n \"used\": [\n {\n \"id\": \"file\",\n \"type\": \"Entity\",\n \"AgentType\": \"Person\",\n \"data\": [\n {\n \"id\": \"osmdata.shp\",\n \"type\": \"Entity\",\n \"records\": 3544\n }\n ]\n },\n {\n \"id\": \"user_input\",\n \"type\": \"Entity\",\n \"input\": \"How far away is the closest hospital from UNSW village\"\n }\n ]\n}",
"url": "https://ogcincubator.github.io/bblock-prov-schema/build/tests/ogc-utils/prov/example_5_1.json"
},
{
"language": "jsonld",
"code": "{\n \"@context\": \"https://ogcincubator.github.io/bblock-prov-schema/build/annotated/ogc-utils/prov/context.jsonld\",\n \"prov:type\": \"prov:Activity\",\n \"generated\": {\n \"id\": \"output\",\n \"type\": \"Entity\",\n \"response\": \"\\u001b[0mLLM Generated Code: \\u001b[96mgdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()\\n\\u001b[0mRaw Response: \\u001b[96m511.8048618048641\\n\\u001b[0mResponse:\\u001b[92mThe closest hospital to UNSW Village is approximately 512 meters away.\"\n },\n \"endedAtTime\": \"2024-11-18T06:44:33.504798Z\",\n \"used\": [\n {\n \"id\": \"file\",\n \"type\": \"Entity\",\n \"data\": [\n {\n \"id\": \"osmdata.shp\",\n \"type\": \"Entity\",\n \"records\": 3544\n }\n ]\n },\n {\n \"id\": \"user_input\",\n \"type\": \"Entity\",\n \"input\": \"How far away is the closest hospital from UNSW village\"\n }\n ]\n}",
"code": "{\n \"@context\": \"https://ogcincubator.github.io/bblock-prov-schema/build/annotated/ogc-utils/prov/context.jsonld\",\n \"prov:type\": \"prov:Activity\",\n \"generated\": {\n \"id\": \"output\",\n \"type\": \"Entity\",\n \"AgentType\": \"SoftwareAgent\",\n \"response\": [\n {\n \"id\": \"LLM Generated Code\",\n \"type\": \"Entity\",\n \"wasGeneratedBy\": \"gemini-1.5-pro-001\",\n \"data\": \"gdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()\"\n },\n {\n \"id\": \"Code Output\",\n \"type\": \"Entity\",\n \"data\": \"511.8048618048641\"\n },\n {\n \"id\": \"Final Output\",\n \"type\": \"Entity\",\n \"wasGeneratedBy\": \"gemini-1.5-flash-001\",\n \"data\": \"The closest hospital to UNSW Village is approximately 512 meters away.\"\n }\n ]\n },\n \"startedAtTime\": \"2024-11-19T05:07:22.927913Z\",\n \"endedAtTime\": \"2024-11-19T05:07:34.304708Z\",\n \"used\": [\n {\n \"id\": \"file\",\n \"type\": \"Entity\",\n \"AgentType\": \"Person\",\n \"data\": [\n {\n \"id\": \"osmdata.shp\",\n \"type\": \"Entity\",\n \"records\": 3544\n }\n ]\n },\n {\n \"id\": \"user_input\",\n \"type\": \"Entity\",\n \"input\": \"How far away is the closest hospital from UNSW village\"\n }\n ]\n}",
"url": "https://ogcincubator.github.io/bblock-prov-schema/build/tests/ogc-utils/prov/example_5_1.jsonld"
},
{
"language": "ttl",
"code": "@prefix prov: <http://www.w3.org/ns/prov#> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\n[] prov:endedAtTime \"2024-11-18T06:44:33.504798+00:00\"^^xsd:dateTime ;\n prov:generated <http://www.example.com/exampleEntity/output> ;\n prov:type \"prov:Activity\" ;\n prov:used <http://www.example.com/exampleEntity/file>,\n <http://www.example.com/exampleEntity/user_input> .\n\n",
"code": "@prefix prov: <http://www.w3.org/ns/prov#> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\n[] prov:endedAtTime \"2024-11-19T05:07:34.304708+00:00\"^^xsd:dateTime ;\n prov:generated <http://www.example.com/exampleEntity/output> ;\n prov:startedAtTime \"2024-11-19T05:07:22.927913+00:00\"^^xsd:dateTime ;\n prov:type \"prov:Activity\" ;\n prov:used <http://www.example.com/exampleEntity/file>,\n <http://www.example.com/exampleEntity/user_input> .\n\n",
"url": "https://ogcincubator.github.io/bblock-prov-schema/build/tests/ogc-utils/prov/example_5_1.ttl"
}
]
Expand Down
53 changes: 48 additions & 5 deletions build/generateddocs/markdown/ogc-utils/prov/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,13 +463,34 @@ A provenance chain for Large Language Model.
"generated": {
"id": "output",
"type": "Entity",
"response": "\u001b[0mLLM Generated Code: \u001b[96mgdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()\n\u001b[0mRaw Response: \u001b[96m511.8048618048641\n\u001b[0mResponse:\u001b[92mThe closest hospital to UNSW Village is approximately 512 meters away."
"AgentType": "SoftwareAgent",
"response": [
{
"id": "LLM Generated Code",
"type": "Entity",
"wasGeneratedBy": "gemini-1.5-pro-001",
"data": "gdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()"
},
{
"id": "Code Output",
"type": "Entity",
"data": "511.8048618048641"
},
{
"id": "Final Output",
"type": "Entity",
"wasGeneratedBy": "gemini-1.5-flash-001",
"data": "The closest hospital to UNSW Village is approximately 512 meters away."
}
]
},
"endedAtTime": "2024-11-18T06:44:33.504798Z",
"startedAtTime": "2024-11-19T05:07:22.927913Z",
"endedAtTime": "2024-11-19T05:07:34.304708Z",
"used": [
{
"id": "file",
"type": "Entity",
"AgentType": "Person",
"data": [
{
"id": "osmdata.shp",
Expand All @@ -495,13 +516,34 @@ A provenance chain for Large Language Model.
"generated": {
"id": "output",
"type": "Entity",
"response": "\u001b[0mLLM Generated Code: \u001b[96mgdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()\n\u001b[0mRaw Response: \u001b[96m511.8048618048641\n\u001b[0mResponse:\u001b[92mThe closest hospital to UNSW Village is approximately 512 meters away."
"AgentType": "SoftwareAgent",
"response": [
{
"id": "LLM Generated Code",
"type": "Entity",
"wasGeneratedBy": "gemini-1.5-pro-001",
"data": "gdf.to_crs(epsg=7856).set_index('name').loc['UNSW Village'].geometry.distance(gdf.to_crs(epsg=7856)[gdf.amenity == 'hospital'].geometry).min()"
},
{
"id": "Code Output",
"type": "Entity",
"data": "511.8048618048641"
},
{
"id": "Final Output",
"type": "Entity",
"wasGeneratedBy": "gemini-1.5-flash-001",
"data": "The closest hospital to UNSW Village is approximately 512 meters away."
}
]
},
"endedAtTime": "2024-11-18T06:44:33.504798Z",
"startedAtTime": "2024-11-19T05:07:22.927913Z",
"endedAtTime": "2024-11-19T05:07:34.304708Z",
"used": [
{
"id": "file",
"type": "Entity",
"AgentType": "Person",
"data": [
{
"id": "osmdata.shp",
Expand All @@ -524,8 +566,9 @@ A provenance chain for Large Language Model.
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
[] prov:endedAtTime "2024-11-18T06:44:33.504798+00:00"^^xsd:dateTime ;
[] prov:endedAtTime "2024-11-19T05:07:34.304708+00:00"^^xsd:dateTime ;
prov:generated <http://www.example.com/exampleEntity/output> ;
prov:startedAtTime "2024-11-19T05:07:22.927913+00:00"^^xsd:dateTime ;
prov:type "prov:Activity" ;
prov:used <http://www.example.com/exampleEntity/file>,
<http://www.example.com/exampleEntity/user_input> .
Expand Down
8 changes: 4 additions & 4 deletions build/register.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "JSON schema for W3C PROV model",
"abstract": "Defines a standardised JSON schema for PROV ontology elements - supporting a graph structure based on an array of objects implementing PROV defined classes with object cross references.",
"description": "Provenance defined using the [W3C PROV-O model](https://www.w3.org/TR/prov-o/) is a DAG (non-cyclic graph) based on three main object types: Entity, Activity and Agent.\n\nThis repository defines a JSON schema and matching JSON-LD context for this model, using the canonical terminology used in the PROV ontology as element names.\n\nIt also defines a context for an optional schema property \"has_provenance\" that can be used to wrap a provenance graph as an array of such objects, to extend the property prov:wasGeneratedBy (whose range is one or more Entity objects) with an explicit schema.\n\n![](https://www.w3.org/TR/prov-o/diagrams/starting-points.svg)\n",
"modified": "2024-11-18T11:05:29.832215",
"modified": "2024-11-20T21:00:18.964576",
"tooling": {
"bblocks-postprocess": {
"commitId": "\"92755a131115293631118b409fa11027d18f8fa3",
Expand All @@ -28,7 +28,7 @@
"itemClass": "schema",
"register": "ogc-utils",
"version": "0.1",
"dateOfLastChange": "2024-11-18",
"dateOfLastChange": "2024-11-20",
"sources": [
{
"link": "https://www.w3.org/TR/prov-o/",
Expand All @@ -43,8 +43,8 @@
],
"shaclRules": {},
"dependsOn": [
"ogc.ogc-utils.iri-or-curie",
"ogc.ogc-utils.json-link"
"ogc.ogc-utils.json-link",
"ogc.ogc-utils.iri-or-curie"
],
"ldContext": "https://ogcincubator.github.io/bblock-prov-schema/build/annotated/ogc-utils/prov/context.jsonld",
"schema": {
Expand Down
Loading

0 comments on commit 91d76be

Please sign in to comment.