Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ewdlop/prolog-notes
https://en.wikipedia.org/wiki/Prolog
https://github.com/ewdlop/prolog-notes
atom depth-first-search horn-clauses knowledge-base literal logical-entailment prolog sld-resolution
Last synced: 1 day ago
JSON representation
https://en.wikipedia.org/wiki/Prolog
- Host: GitHub
- URL: https://github.com/ewdlop/prolog-notes
- Owner: ewdlop
- License: gpl-2.0
- Created: 2024-11-02T18:13:19.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-24T04:07:13.000Z (4 days ago)
- Last Synced: 2024-12-24T05:20:30.227Z (4 days ago)
- Topics: atom, depth-first-search, horn-clauses, knowledge-base, literal, logical-entailment, prolog, sld-resolution
- Language: Prolog
- Homepage:
- Size: 109 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Prolog-notes
## Locke's Philosophy
[Locke's Philosophy](https://en.wikipedia.org/wiki/John_Locke)
## https://www.cs.trincoll.edu/~ram/cpsc352/notes/prolog/factsrules.html
```prolog
% Relational Database "Representation" in Prolog
% Define tables as facts
% Table: employees(employee_id, name, department_id)
employee(1, john, 101).
employee(2, mary, 102).
employee(3, tom, 101).
employee(4, susan, 103).% Table: departments(department_id, department_name)
department(101, sales).
department(102, hr).
department(103, it).% Foreign key relationship: employees.department_id -> departments.department_id
% Rule to join employees and departments (SQL equivalent: SELECT * FROM employees JOIN departments)
employee_department(EmployeeName, DepartmentName) :-
employee(_, EmployeeName, DepartmentID),
department(DepartmentID, DepartmentName).% Queries:
% Who works in the Sales department?
% ?- employee_department(EmployeeName, sales).% Which department does Tom work in?
% ?- employee_department(tom, DepartmentName).```