|
| 1 | +# Migrating to gist v13.0 from v12.0 |
| 2 | + |
| 3 | +This file gives a quick overview of using the migration utilities provided |
| 4 | +by the gist team to help migrate from the previous version of gist. |
| 5 | + |
| 6 | +> See also additional documentation in the file `docs/MajorVersionMigration.md`. |
| 7 | +
|
| 8 | +## Important Remarks |
| 9 | + |
| 10 | +- **These scripts are not cumulative; you must run the migrations for each version of gist |
| 11 | + in sequence.** |
| 12 | + |
| 13 | +- **These utilities are a starting point.** You should review them before running |
| 14 | + them to make sure you approve of the actions prior to using them. |
| 15 | + |
| 16 | +- **These utilities do not handle everything**, in some cases we can only warn you |
| 17 | + about changes that were made in gist and you will need to decide how you want |
| 18 | + to handle the changes. |
| 19 | + |
| 20 | +## Migration Queries |
| 21 | + |
| 22 | +All of our migration tools are SPARQL queries. |
| 23 | + |
| 24 | +The following directory structure holds the migration scripts: |
| 25 | + |
| 26 | +``` |
| 27 | +. |
| 28 | +└── queries/ |
| 29 | + │ |
| 30 | + ├── action/ |
| 31 | + │ ├── default/ |
| 32 | + │ │ └── *.rq |
| 33 | + │ └── ngraphs/ |
| 34 | + │ └── *.rq |
| 35 | + │ |
| 36 | + ├── report/ |
| 37 | + │ ├── default/ |
| 38 | + │ │ └── *.rq |
| 39 | + │ └── ngraphs/ |
| 40 | + │ └── *.rq |
| 41 | + │ |
| 42 | + └── uom_queries/ |
| 43 | + └── *.rq |
| 44 | +
|
| 45 | +``` |
| 46 | + |
| 47 | +The `./queries/` directory contains the following directories: |
| 48 | + |
| 49 | +- `./queries/action/` : Update queries for migrating from Gist v12.0 to v13.0 |
| 50 | + |
| 51 | +- `./queries/report/` : Validation queries that return SHACL validation reports for data that does not comply with Gist v13.0 |
| 52 | + |
| 53 | +- `./queries/uom_queries/` : Queries for migrating to the new ontology for magnitudes, aspects, and units of measure |
| 54 | + |
| 55 | +The action and report directories each contain the following two directories: |
| 56 | + |
| 57 | +- `default/` : These queries only work on the default graph`*` |
| 58 | + |
| 59 | + > `*` the handling of these queries will be dependent upon which Triplestore you are using and how it was configured. Some Triplestores will only use |
| 60 | + > triples in the default graph, some will use all triples in all named graphs. |
| 61 | +
|
| 62 | +- `ngraphs/` : These queries only work on named graphs |
| 63 | + |
| 64 | + |
| 65 | +## Requirements |
| 66 | + |
| 67 | +These migration scripts are meant to be run using the open source `onto_tool` |
| 68 | +program. Information about onto_tool and how to install it, is available at |
| 69 | +[github](https://github.com/semanticarts/ontology-toolkit). |
| 70 | + |
| 71 | +## Run on local files |
| 72 | + |
| 73 | +> Note: A known limitation of `onto_tool` is that it does not support named graphs when run against local files. It does support named graphs when run against a SPARQL endpoint. |
| 74 | +
|
| 75 | +1. Starting in this directory, put source data files in the `./input/` directory (the sample data can be removed). See the onto_tool documentation for which file formats are supported. |
| 76 | + |
| 77 | + > The `migrate_local.yaml` file currently looks in the `./input/` directory for `*.owl` and `*.ttl` files. If other formats are supported and you plan to use them, you will need to update the yaml. |
| 78 | +
|
| 79 | +2. Execute the following command: |
| 80 | + |
| 81 | + ```shell |
| 82 | + onto_tool bundle migrate_local.yaml |
| 83 | + ``` |
| 84 | + |
| 85 | +3. `onto_tool` will output to STDOUT, you should see something like the following (this is the output from the sample data included in the `./input/` directory): |
| 86 | + |
| 87 | + ``` |
| 88 | + INFO:root:Rename properties in default graph. |
| 89 | + INFO:root:Replace address classes in default graph. |
| 90 | + INFO:root:Replace properties with inverses in default graph. |
| 91 | + INFO:root:Use new gist:offers property in default graph (script 1). |
| 92 | + INFO:root:Use new gist:offers property in default graph (script 2). |
| 93 | + INFO:root:Rename properties in named graphs. |
| 94 | + INFO:root:Replace address classes in named graphs. |
| 95 | + INFO:root:Replace properties with inverses in named graphs. |
| 96 | + INFO:root:Use new gist:offers property in named graphs (script 1). |
| 97 | + INFO:root:Use new gist:offers property in named graphs (script 2). |
| 98 | + INFO:root:Check the default graph for other items that should be reviewed. |
| 99 | + INFO:root:Check named graphs for other items that should be reviewed. |
| 100 | + ``` |
| 101 | + |
| 102 | + - Output files will be created in the `./output/` directory. |
| 103 | + |
| 104 | + - Report files will be created in the `./reports/` directory. |
| 105 | + |
| 106 | +## Run Against SPARQL Endpoint |
| 107 | + |
| 108 | +You will need to tell `onto_tool` the URL of your SPARQL endpoint. You can do that |
| 109 | +by editing the `migration_endpoint.yaml` file, or you can put it into the command |
| 110 | +line execution like this: |
| 111 | + |
| 112 | +> Note: Use your own values in place of `<...>` |
| 113 | +
|
| 114 | +```shell |
| 115 | +onto_tool bundle -v user <USER> -v password <PWD> |
| 116 | + -v endpoint <ENDPOINT-URI> |
| 117 | + [ -v update_endpoint <UPDATE-URI> ] |
| 118 | + -v report <REPORT-DIR> migrate_endpoint.yaml |
| 119 | +``` |
| 120 | + |
| 121 | +## Examples: |
| 122 | + |
| 123 | +- renameProperties replaces `gist:isGeographicallyContainedIn` with `gist:isGeoContainedIn` |
| 124 | +- replaceAddressClasses replaces `gist:EmailAddress` with `gist:ElectronicAddress` |
| 125 | +- replaceAddressClasses replaces `gist:StreetAddress` with `gist:PhysicalAddress` |
| 126 | + |
| 127 | +The different types and uses of addresses can be modeled as categories; see [the address migration documentation(AddressMigration.md) as well as the [full documentation of the new address model](/docs/model_documentation/AddressGuidance.md). |
| 128 | + |
| 129 | +- replacePropertiesWithInverses replaces `gist:hasPart` with `gist:isPartOf` |
| 130 | +- useOffersProperty (scripts 1 and 2) replaces `gist:hasPart` with `gist:offers` in the context of an offer |
| 131 | +- useOffersProperty (scripts 3 and 4) replaces `gist:isPartOf` with `gist:offers` in the context of an offer |
| 132 | + |
| 133 | +When converting data about offers, the offer and any sub-offer must belong to a the `gist:Offer` class or a subclass of it for the script to recognize the thing being offered. |
| 134 | + |
| 135 | +The examples above are not a complete description of each script; read the scripts to see the complete list of changes they make to the data. |
| 136 | + |
| 137 | +## Notes |
| 138 | + |
| 139 | +- read the scripts to see the complete list of changes they make to the data (the examples above are not comprehensive). |
| 140 | +- renameProperties, replaceAddressClasses, and replacePropertiesWithInverses remove classes and properties that were deprecated in release 12, i.e. they perform data conversion necessary to conform to gist 13. |
| 141 | +- useOffersProperty is optional for conformance with gist 13 |
| 142 | +- be sure to update all artifacts such as data ingestion, queries, forms, documentation, etc. along with converting the data |
| 143 | +- for data conversion of magnitudes and units of measure, see the README file in the uom_queries directory |
0 commit comments