This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject clj-fl-example "0.1.0" | |
:description "Human Resources Management System Use cases for the Frame Language library in CLojure. | |
Note that the project contains the dependencies necessary to be used with LightTable too" | |
:dependencies [[org.clojure/clojure "1.6.0"] | |
[clj-time "0.6.0"] | |
[clj-fl "0.1.0-prealfa10"] | |
[lein-light-nrepl "0.0.18"] | |
[adamclements/vijual "0.3.0-SNAPSHOT"]] | |
:repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;-------------------------------------------Knowledge Base start------------------------------------------------ | |
[ | |
;------ Frame Language | |
{:frame {:value "frame"} | |
:description {:value "A frame is composed of one or more slots. Each frame represent a concept or a class of object or an object"}} | |
{:frame {:value "slot"} | |
:description {:value "One or more slots form a frame. Each slot represent a property or a feature of the frame"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clj-fl-examples.renderlib | |
(:require [clj-fl.core :refer :all]) | |
(import [java.awt Color] | |
[javax.imageio ImageIO] | |
[javax.swing JPanel JFrame])) | |
(def frame (atom nil)) | |
(def gfx (atom nil)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
;-------------------------------------------Knowledge Base start-------------------------------------------------- | |
{:frame {:value "bu"} | |
:name {:value "Building Unit"} | |
:description {:value "A man-made structure with a roof and walls standing more or less permanently in one place. Can be composed of other building unit"} | |
:render2d {:proc render2dbu} | |
:showcofs {:proc showcofs}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clj-fl-examples.demons | |
(:require [clj-fl.core :refer :all] | |
[clj-fl-examples.renderlib :refer :all])) | |
(defn render2dbu [f] | |
(let [ims (fget f :cof :value) | |
namestr (fget f :name :value)] | |
(drawcolorstring | |
(list 0 0 255) namestr (fget f :sps :value)) | |
(dorun (map #((resolve (fget-ii % :render2d :proc)) %) ims)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
;-------------------------------------------Knowledge Base start-------------------------------------------------- | |
;------ AKO frames | |
{:frame {:value "bu"} | |
:name {:value "Building Unit"} | |
:description {:value "A man-made structure with a roof and walls standing more or less permanently in one place. Can be composed of other building unit"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn showcofs | |
"show the hierarchy :cof for a given frame f" | |
[f] | |
(let [cofs (fget f :cof :value) cofslist (#(if-not (seq? %)(list %) %) cofs)] ;1 | |
(if (nil? cofs) | |
(vector f) ;2 | |
(reduce #( conj %1 ((if-let [showproc (fget-ii %2 :showcofs :proc)] (eval showproc) (vector %2)) %2)) (vector f) cofslist)))) ;3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;-------------------------------------------Knowledge Base start-------------------------------------------------- | |
[ | |
;------ AKO frames | |
{:frame {:value "bu"} | |
:name {:value "Building Unit"} | |
:description {:value "A man-made structure with a roof and walls standing more or less permanently in one place. Can be composed of other building unit"}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; this gist contain the CLojure code for the blog post: | |
;; http://highorderdysfunctions.blogspot.it/2014/03/frame-language-in-clojure-part-2.html | |
;; Remember to include dependencies for [clj-time "0.6.0"] and [seesaw "1.4.4"] in your project file. | |
(ns employees.core) | |
(use 'seesaw.core) | |
(use 'clj-time.core) | |
(use 'clj-time.format) | |
(use 'clojure.test) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; this gist contain the CLojure code for the blog post: | |
;; http://highorderdysfunctions.blogspot.it/2014/02/frame-language-in-clojure-part-1.html | |
(ns employees.core) | |
(def Henry {:is-a {:value 'system-analyst} | |
:working-at {:value 'unit-i} | |
:recruitment-date {:value "14/03/2010"} | |
:gross-salary {:value 3000,00}}) | |
(defn fget [frame slot facet] |