{ "cells": [ { "cell_type": "markdown", "id": "bulgarian-scotland", "metadata": {}, "source": [ "# Type Constraint (Domain)" ] }, { "cell_type": "code", "execution_count": 1, "id": "sitting-medline", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[2021-03-08 12:08:21 query]: SQL Translation:\r\n", "---------------------------------------------\r\n", " SELECT graph_1_c1.\"id\" \"_aLias.id\", graph_1_c1.\"node1\" \"_aLias.node1\", graph_2_c2.\"label\" \"_aLias.label\", graph_2_c2.\"node2\" \"_aLias.node2\", graph_1_c1.\"node2;wikidatatype\" \"_aLias.node2;wikidatatype\"\r\n", " FROM graph_1 AS graph_1_c1, graph_2 AS graph_2_c2\r\n", " WHERE graph_1_c1.\"label\"=?\r\n", " AND graph_1_c1.\"node2;wikidatatype\"=graph_1_c1.\"node2;wikidatatype\"\r\n", " AND ((graph_1_c1.\"id\" = graph_2_c2.\"node1\") AND (graph_1_c1.\"node2\" = ?))\r\n", " PARAS: ['P2302', 'Q21503250']\r\n", "---------------------------------------------\r\n" ] } ], "source": [ "!kgtk --debug query -i ../../gdrive-kgtk-dump-2020-12-07/claims.properties.tsv.gz \\\n", " ../../gdrive-kgtk-dump-2020-12-07/qualifiers.properties.tsv.gz \\\n", " --match \"p: (nodeProp1)-[nodePropEdge:P2302]->(nodeabc{wikidatatype:wikidatatype}), q: (nodePropEdge1)-[nodePropEdgeProps]->(val)\" \\\n", " --where 'nodePropEdge.id = nodePropEdge1 and nodeabc = \"Q21503250\"' \\\n", " --return 'nodePropEdge.id as id, nodeProp1 as node1, nodePropEdgeProps.label as label, val as node2, wikidatatype as `node2;wikidatatype`' \\\n", " -o ../../constraintsOP/typeConstraint/claims.type-constraints_all.tsv \\\n", " --graph-cache ~/sqlite3_caches/temp156.sqlite3.db" ] }, { "cell_type": "code", "execution_count": null, "id": "informative-needle", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "kgtkEnv", "language": "python", "name": "kgtkenv" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 5 }