{"id":49453659,"url":"https://github.com/ithailevi/expert","last_synced_at":"2026-06-02T05:00:44.145Z","repository":{"id":6574024,"uuid":"7816029","full_name":"ithailevi/expert","owner":"ithailevi","description":"Expert.js - the knowledge base system for node.js","archived":false,"fork":false,"pushed_at":"2014-06-09T06:15:35.000Z","size":197,"stargazers_count":82,"open_issues_count":2,"forks_count":9,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-09-19T10:14:25.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ithailevi.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":"2013-01-25T07:56:33.000Z","updated_at":"2025-07-23T21:21:59.000Z","dependencies_parsed_at":"2022-09-06T17:51:48.631Z","dependency_job_id":null,"html_url":"https://github.com/ithailevi/expert","commit_stats":null,"previous_names":["l3v3l9/expert"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ithailevi/expert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ithailevi%2Fexpert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ithailevi%2Fexpert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ithailevi%2Fexpert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ithailevi%2Fexpert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ithailevi","download_url":"https://codeload.github.com/ithailevi/expert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ithailevi%2Fexpert/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33806987,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-04-30T04:01:03.702Z","updated_at":"2026-06-02T05:00:44.140Z","avatar_url":"https://github.com/ithailevi.png","language":"JavaScript","funding_links":[],"categories":["📦 Legacy \u0026 Inactive Projects"],"sub_categories":[],"readme":"Expert.js\n=========\n[![Build Status](https://travis-ci.org/L3V3L9/expert.png)](https://travis-ci.org/L3V3L9/expert)\nExpert.js is miniature semantic network framework written in JavaScript.\n\nMotivation\n----------\nRepresenting knowledge for artificial intelligence applications can be simplified\nby the flexibility of scripting languages. Expert.js provides a DSL-like constructs \nfor building semantic networks. The result is readable code, that's easy to work with.\n\nQuick Example\n-------------\n```javascript\nvar expert = require('expert'),\n    _ = require('underscore');\n\nvar domain   = expert.Domain(),\n    Concept  = domain.Concept,\n    Relation = domain.Relation,\n\n    mammal = Concept.create({id:\"mammal\"}),\n    fish = Concept.create({id:\"fish\"}),\n    dog = Concept.create({id:\"dog\"}),\n    cat = Concept.create({id:\"cat\"}),\n    mouse = Concept.create({id:\"mouse\"}),\n    whale = Concept.create({id:\"whale\"}),\n    salmon = Concept.create({id:\"salmon\"}),\n\n    fur = Concept.create({id:\"fur\"}),\n    bark = Concept.create({id:\"bark\"}),\n    swim = Concept.create({id:\"swim\"}),\n\n    isa = domain.isa,\n    example = domain.example,\n\n    has = Relation.create({id:\"has\"}),\n    whatHas = Relation.create({id:\"what has\",inverseFor:has}),\n\n    can = Relation.create({id:\"can\"}),\n    whatCan = Relation.create({id:\"what can\",inverseFor:can}),\n\n    biggerThan = Relation.create({id:\"biggerThan\",isTransitive: true});\n    smallerThan = Relation.create({id:\"smallerThan\",isTransitive: true, \n                                   inverseFor:biggerThan});\n\nsalmon\n   .isa(fish)\n   .biggerThan(mouse)\n   .can(swim);\n\nwhale\n   .isa(mammal)\n   .biggerThan(dog)\n   .biggerThan(cat)\n   .can(swim);\n\ndog\n   .isa(mammal)\n   .has(fur)\n   .can(bark)\n   .biggerThan(mouse);\n\ncat\n   .isa(mammal)\n   .has(fur)\n   .biggerThan(mouse);\n\nmouse\n   .isa(mammal)\n   .has(fur);\n\nconsole.log(\"what has fur?\");\nvar answer1 = whatHas(fur);\nconsole.log(_.map( answer1, function(c){ return c.id; }));\n\nconsole.log(\"what mammal that a mouse is smaller than, can swim?\");\nvar answer2 = _.intersection( example(mammal),\n                              whatCan(swim),\n                              smallerThan(mouse) );\nconsole.log(_.map( answer2, function(c){ return c.id; }));\n\n```\n\nStep by Step\n------------\n\nWe begin by including Expert.js and Underscore.js. \n\n```javascript\nvar expert = require('expert'),\n    _ = require('underscore');\n```\n\nTo begin working with Expert.js you must first create a Domain object. \nConcepts and Relations are part of a Domain. You can separate different\nsemantic networks using different Domains. \n\nThe Concept and Relation objects are mere references and are declared\nfor brevity.\n\n```javascript\nvar domain   = expert.Domain(),\n    Concept  = domain.Concept,\n    Relation = domain.Relation,\n```\n\nConcepts are the building blocks of your semantic network. You \ncan also provide a unique identifier that can help you identify \nthe concepts later on. Concepts can be tangible or abstract. We will\nsoon see how you can describe the abstraction hierarchy of related\nConcepts using an \"isa\" relation.\n\n```javascript\n    mammal = Concept.create({id:\"mammal\"}),\n    fish = Concept.create({id:\"fish\"}),\n    dog = Concept.create({id:\"dog\"}),\n    cat = Concept.create({id:\"cat\"}),\n    mouse = Concept.create({id:\"mouse\"}),\n    whale = Concept.create({id:\"whale\"}),\n    salmon = Concept.create({id:\"salmon\"}),\n\n    fur = Concept.create({id:\"fur\"}),\n    bark = Concept.create({id:\"bark\"}),\n    swim = Concept.create({id:\"swim\"}),\n```\n\nExpert.js comes with 2 predefined relations: \"isa\" and \"example\". You \ncan use an \"isa\" relation to express abstraction hierarchies of Concepts. In this\nexample we will use it to indicate that a dog, a cat, a whale and a mouse\nare kinds of mammal. \n\n```javascript\n    isa = domain.isa,\n    example = domain.example,\n```\n\nThe \"example\" relation is the inverse relation of \"isa\". Inverse relations\nmaintain a back link between related concepts. This will allow you to \nquery relations from an inverse direction in the semantic network.\n\nYou can define as many relation types as you wish. Relations\nallow you to introduce facts to your network of Concepts.\nRelations can also have unique identifiers. If you use an\nidentifier that is also a valid JavaScript function name,\nExpert.js will create a method for your Domain's Concept\nprototype - for syntactic sugar.\n\n```javascript\n    has = Relation.create({id:\"has\"}),\n    whatHas = Relation.create({id:\"what has\",inverseFor:has}),\n\n    can = Relation.create({id:\"can\"}),\n    whatCan = Relation.create({id:\"what can\",inverseFor:can}),\n\n    biggerThan = Relation.create({id:\"biggerThan\",isTransitive: true});\n    smallerThan = Relation.create({id:\"smallerThan\",isTransitive: true, \n                                   inverseFor:biggerThan});\n```\n\nWe can now use our defined relations to establish facts. In this example\nwe use the shorthand method. This method was made possible because we \nused valid function names as our relations identifiers.\n\n```javascript\nsalmon\n   .isa(fish)\n   .biggerThan(mouse)\n   .can(swim);\n\nwhale\n   .isa(mammal)\n   .biggerThan(dog)\n   .biggerThan(cat)\n   .can(swim);\n\ndog\n   .isa(mammal)\n   .has(fur)\n   .can(bark)\n   .biggerThan(mouse);\n\ncat\n   .isa(mammal)\n   .has(fur)\n   .biggerThan(mouse);\n\nmouse\n   .isa(mammal)\n   .has(fur);\n```\n\nFinally, we can inspect our semantic network. Note how we use Underscore.js to do a primitive \"join\" \nover inverse relations:\n\n```javascript\nconsole.log(\"what has fur?\");\nvar answer1 = whatHas(fur);\nconsole.log(_.map( answer1, function(c){ return c.id; }));\n\nconsole.log(\"what mammal that a mouse is small than, can swim?\");\nvar answer2 = _.intersection( example(mammal),\n                              whatCan(swim),\n                              smallerThan(mouse) );\nconsole.log(_.map( answer2, function(c){ return c.id; }));\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fithailevi%2Fexpert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fithailevi%2Fexpert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fithailevi%2Fexpert/lists"}