{"id":18695821,"url":"https://github.com/rdflib/graph-pattern-learner","last_synced_at":"2025-04-12T07:30:44.764Z","repository":{"id":9868168,"uuid":"58070112","full_name":"RDFLib/graph-pattern-learner","owner":"RDFLib","description":"Evolutionary Graph Pattern Learner that learns SPARQL queries for a given set of source-target-pairs from an endpoint.","archived":false,"fork":false,"pushed_at":"2023-01-23T21:03:36.000Z","size":1212,"stargazers_count":86,"open_issues_count":14,"forks_count":15,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-26T02:42:48.199Z","etag":null,"topics":["algorithm","associations","data-mining","embeddings","end-to-end-learning","graph-algorithms","graph-pattern-learner","graph-queries","human-associations","knowledge-graph","knowledge-mining","learners","linked-data","machine-learning","pattern-learning","prediction","rdf","semantic-web","sparql"],"latest_commit_sha":null,"homepage":"https://w3id.org/associations","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RDFLib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-04T17:16:58.000Z","updated_at":"2025-03-21T10:13:44.000Z","dependencies_parsed_at":"2023-02-13T03:15:29.021Z","dependency_job_id":null,"html_url":"https://github.com/RDFLib/graph-pattern-learner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDFLib%2Fgraph-pattern-learner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDFLib%2Fgraph-pattern-learner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDFLib%2Fgraph-pattern-learner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RDFLib%2Fgraph-pattern-learner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RDFLib","download_url":"https://codeload.github.com/RDFLib/graph-pattern-learner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248533520,"owners_count":21120109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","associations","data-mining","embeddings","end-to-end-learning","graph-algorithms","graph-pattern-learner","graph-queries","human-associations","knowledge-graph","knowledge-mining","learners","linked-data","machine-learning","pattern-learning","prediction","rdf","semantic-web","sparql"],"created_at":"2024-11-07T11:16:22.144Z","updated_at":"2025-04-12T07:30:43.915Z","avatar_url":"https://github.com/RDFLib.png","language":"Python","readme":"Graph Pattern Learner\n=====================\n\n(Work in progress...)\n\nIn this repository you find the code for a graph pattern learner. Given a list\nof source-target-pairs and a SPARQL endpoint, it will try to learn SPARQL\npatterns. Given a source, the learned patterns will try to lead you to the right\ntarget.\n\nThe algorithm was first developed on a list of human associations that had been\nmapped to DBpedia entities, as can be seen in\n[data/gt_associations.csv](./data/gt_associations.csv):\n\n| source                            | target                            |\n| --------------------------------- | --------------------------------- |\n| http://dbpedia.org/resource/Bacon | http://dbpedia.org/resource/Egg   |\n| http://dbpedia.org/resource/Baker | http://dbpedia.org/resource/Bread |\n| http://dbpedia.org/resource/Crow  | http://dbpedia.org/resource/Bird  |\n| http://dbpedia.org/resource/Elm   | http://dbpedia.org/resource/Tree  |\n| http://dbpedia.org/resource/Gull  | http://dbpedia.org/resource/Bird  |\n| ...                               | ...                               |\n\nAs you can immediately see, associations don't only follow a single pattern. Our\nalgorithm is designed to be able to deal with this. It will try to learn several\npatterns, which in combination model your input list of source-target-pairs. If\nyour list of source-target-pairs is less complicated, the algorithm will happily\nterminate earlier.\n\nYou can find more information about the algorithm and learning patterns for\nhuman associations on https://w3id.org/associations . The page also includes\npublications, as well as the resulting patterns learned for human associations\nfrom a local DBpedia endpoint including wikilinks.\n\n\nRequirements\n------------\n\nTo run the graph pattern learner, we recommend:\n- 8 cores (for parallel execution)\n- more than 8 GB free RAM\n- Linux 64 bit with Python 2.7\n\n\nInstallation\n------------\n\nFor now, the suggested installation method is via git clone (also allows easier\ncontributions):\n\n    git clone https://github.com/RDFLib/graph-pattern-learner.git\n    cd graph-pattern-learner\n\nAfterwards, to setup the virtual environment and install all dependencies in it:\n\n    virtualenv venv \u0026\u0026\n    . venv/bin/activate \u0026\u0026\n    pip install --upgrade pip setuptools \u0026\u0026\n    pip install -r requirements.txt \u0026\u0026\n    deactivate\n\n\nRunning the learner\n-------------------\n\nBefore actually running the evolutionary algorithm, please consider that it will\nissue a lot of queries to the endpoint you're specifying. Please don't run this\nagainst public endpoints without asking the providers first. It is likely that\nyou will disrupt their service or get blacklisted. I suggest running against an\nown local endpoint filled with the datasets you're interested in. If you really\nwant to run this against public endpoints, at least don't run the multi-process\nversion, but restrict yourself to one process.\n\nAlways feel free to reach out for help or feedback via the issue tracker or via\nassociations at joernhees de. We might even run the learner for you ;)\n\nTo get a list of all available options run:\n\n    . venv/bin/activate \u0026\u0026 python run.py --help ; deactivate\n\nDon't be scared by the length, most options use sane defaults, but it's nice to\nbe able to change things once you become more familiar with your data and the\nlearner.\n\nThe options you will definitely be interested are:\n\n    --associations_filename (defaults to ./data/gt_associations.csv)\n    --sparql_endpoint (defaults to http://localhost:8890/sparql)\n\nTo run a full training cycle, you probably might want to execute this:\n\n    ./run_create_bundle.sh --processes=8 --sparql_endpoint=... --visualise \\\n        ./results/your_bundle_name \\\n        --associations_filename=... # ... other-options ...\n\nThe algorithm will then by default randomly split your input list of\nsource-target-pairs into a training and a test set, train on the training set,\nvisualise the resulting learned patterns in `./results/bundle_name/visualise`,\nbefore evaluating predictions on first the training- and then the test-set.\n\nTo use a learned model for prediction, you can run:\n\n    . venv/bin/activate \u0026\u0026 \\\n    PYTHONIOENCODING=utf-8 python \\\n        -m scoop -n8 run.py --associations_filename=... --sparql_endpoint=... \\\n        --RES_DIR=./results/your_bundle_name/results \\\n        --predict=manual ; \\\n    deactivate\n\n\nContributors\n------------\n * Jörn Hees\n * Rouven Bauer (visualise code)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdflib%2Fgraph-pattern-learner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frdflib%2Fgraph-pattern-learner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frdflib%2Fgraph-pattern-learner/lists"}