;;; -*- Mode:Lisp; Package:ONTOLINGUA-USER; Syntax:COMMON-LISP; Base:10 -*- 

;;; Simple Bicycle Design Ontology 

(in-package "ONTOLINGUA-USER") 

(define-theory SIMPLE-BIKES (vt-design standard-units) 
  "") 

(in-theory 'SIMPLE-BIKES) 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;   SIMPLE BICYCLE DESIGN ONTOLOGY  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

(define-class BIKE-COMPONENT (?b) 
  "Root class for bike component classes." 

  :def (and (component ?b) 
	    (has-attribute ?b weight) 
	    (scalar-quantity (weight ?b)) 
	    (= (dimension (weight ?b)) 
	       mass-dimension))) 

(define-class BICYCLE (?b) 
  :def (and (bike-component ?b) 
	     
	    (has-subpart ?b bike.front-wheel) 
            (front-wheel (bike.front-wheel ?b)) 

	    (has-subpart ?b bike.rear-wheel) 
	    (rear-wheel (bike.rear-wheel ?b)) 

	    (has-subpart ?b bike.transmission) 
	    (transmission (bike.transmission ?b)) 

	    (has-subpart ?b bike.stem) 
	    (stem (bike.stem ?b)) 

	    (has-subpart ?b bike.bars) 
	    (handlebars (bike.bars ?b)) 

	    (has-subpart ?b bike.frame) 
	    (frame (bike.frame ?b)) 

	    (has-subpart ?b bike.brakes) 
	    (brake-system (bike.brakes ?b)) 

	    (has-subpart ?b bike.seat) 
	    (seat (bike.seat ?b)) 

	    (has-constraint  
	     ?b  
	     (the-constraint 
	      '(= (frame.seat-post-size (bike.frame ?x)) 
		  (seat.post-dia (bike.seat ?x))))) 

	    (has-constraint  
	     ?b  
	     (the-constraint 
	      '(= (stem.clamp-dia (bike.stem ?x)) 
		  (handlebars.dia (bike.bars ?x))))) 

	    (has-constraint  
	     ?b  
	     (the-constraint 
	      '(= (bottom-bracket.type (bike.frame ?x)) 
		  (bottom-bracket.type  
		   (transmission.bottom-bracket (bike.transmission ?x)))))) 

	    (has-constraint  
	     ?b  
	     (the-constraint 
	      '(= (size (wheel.hub (rear-wheel ?x))) 
		  (size (trans.freewheel (bike.transmission ?x)))))))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Bicycle Subpart Classes 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(define-class TRANSMISSION (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x number-of-speeds) 
	    (positive-integer (number-of-speeds ?x)) 

	    (has-subpart ?x transmission.bottom-bracket) 
	    (has-subpart ?x transmission.chain) 
	    (has-subpart ?x transmission.freewheel) 
	    (has-subpart ?x transmission.crankset) 
	    (has-subpart ?x transmission.pedals))) 


(define-class BRAKE-SYSTEM (?x) 
  :def (bike-component ?x)) 


(define-class FRAME (?x) 
  "Frame including forks and headset." 
  :def (and (bike-component ?x) 

	    (has-attribute ?x model-id) 
	    (has-attribute ?x frame.size) 
	    (has-attribute ?x frame.seat-post-size) 
	    (has-attribute ?x bottom-bracket.type) 
	    )) 


(define-class STEM (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id) 
	    (has-attribute ?x stem.clamp-dia) 
	    (has-attribute ?x stem.length) 
	    )) 


(define-class HANDLEBARS (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id) 
	    (has-attribute ?x handlebars.dia) 
	    )) 


(define-class SEAT (?x) 
  :def (and (bike-component ?x) 

	    (has-subpart ?x seat.saddle) 
            (saddle (seat.saddle ?x)) 
	    (has-subpart ?x seat.seat-post) 
            (seat-post (seat.post ?x)))) 


(define-class WHEEL-ASSY (?x) 
  :def (and (bike-component ?x) 

	    (has-subpart ?x wheel-assy.wheel) 
	    (wheel (wheel-assy.wheel ?x)) 

	    (has-subpart ?x wheel-assy.tire) 
	    (tire (wheel-assy.tire ?x)) 

	    (has-constraint  
	     ?x 
	     (the-constraint 
	      '(and (=< (width (wheel-assy.tire ?z)) 
			(max-width (wheel-assy.wheel ?z))) 
		    (>= (width (wheel-assy.tire ?z)) 
			(min-width (wheel-assy.wheel ?z)))))))) 


(define-class FRONT-WHEEL (?x) 
  :def (and (wheel-assy ?x) 

	    (has-constraint  
	     ?x 
	     (the-constraint 
	      '(= (hubtype (wheel-assy.wheel ?z)) 
		  "FRONT"))))) 


(define-class REAR-WHEEL (?x) 
  :def (and (wheel-assy ?x) 

	    (has-constraint  
	     ?x 
	     (the-constraint 
	      '(= (hubtype (wheel-assy.wheel ?z)) 
		  "REAR"))))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Transmission Subclasses 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

(define-class MULTI-SPD-TRANSMISSION (?t) 
  :def (and (bike-component ?t) 

	    (has-constraint  
	     ?t 
	     (the-constraint 
	      '(> (number-of-speeds ?x) 1))) 

	    (has-constraint  
	     ?t 
	     (the-constraint 
	      '(= (number-of-speeds ?x)  
		  (* (number-of-speeds  
		      (transmission.freewheel ?x)) 
		     (number-of-rings  
		      (transmission.crankset ?x)))))) 

	    (has-subpart ?t transmission.front-derailer) 
	    (front-derailer (transmission.front-derailer ?t)) 

	    (has-subpart ?t transmission.rear-derailer) 
	    (rear-derailer (transmission.rear-derailer ?t)))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Brake Subclasses 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(define-class COASTER-BRAKE (?x) 
  :def (and (brake-system ?x) 
	    (has-attribute ?x model-id))) 


(define-class HAND-BRAKES (?x) 
  :def (and (brake-system ?x) 
	    (has-attribute ?x model-id))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Seat Subpart Classes 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(define-class SADDLE (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x saddle.model-id))) 


(define-class SEAT-POST (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x seat-post.model-id) 
	    (has-attribute ?x seat-post.tube-dia))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Transmission Subpart Classes 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(define-class CHAIN (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id))) 


(define-class PEDALS (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id))) 


(define-class CRANKSET (?x) 
  "Crankset includes chain rings." 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id) 
	    (has-attribute ?x number-of-rings))) 


(define-class BOTTOM-BRACKET (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id) 
	    (has-attribute ?x bottom-bracket.type))) 


(define-class FREEWHEEL (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id) 
	    (has-attribute ?x number-of-speeds))) 

(define-class FRONT-DERAILER (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id))) 


(define-class REAR-DERAILER (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x model-id))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Wheel-Assy Subpart Classes 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(define-class WHEEL (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x hubtype) 
	    (has-attribute ?x max-width) 
	    (has-attribute ?x min-width))) 

(define-class TIRE (?x) 
  :def (and (bike-component ?x) 
	    (has-attribute ?x width))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Frame Subclasses 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(define-class BATTAGLIN-SL (?f) 
  :def (and (frame ?f) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (model-id ?x) "10-9170"))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(member (frame.size ?x) 
		       (setof (* 49 cm) 
			      (* 51 cm) 
			      (* 53 cm) 
			      (* 55 cm) 
			      (* 57 cm) 
			      (* 59 cm))))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (frame.seat-post-size ?x) 
		  (* 27.2 mm)))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (bottom-bracket.type ?x) 
		  "Italian"))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (component.cost ?x) (* 575 dollars)))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (weight ?x) (* 5.7 lbs)))))) 


(define-class BATTAGLIN-SLX (?f) 
  :def (and (frame ?f) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (model-id ?x) "10-9160"))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(member (frame.size ?x) 
		       (setof (* 48 cm) 
			      (* 50 cm) 
			      (* 52 cm) 
			      (* 54 cm) 
			      (* 56 cm) 
			      (* 58 cm) 
			      (* 60 cm) 
			      (* 62 cm) 
			      )))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (frame.seat-post-size ?x) 
		  (* 27.2 mm)))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (bottom-bracket.type ?x) 
		  "Italian"))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (component.cost ?x) (* 795 dollars)))) 

	    (has-constraint  
	     ?f 
	     (the-constraint 
	      '(= (weight ?x) (* 6.0 lbs)))))) 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;  Stem Subclasses 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(define-class ITM-400 (?s) 
  :def (and (stem ?s) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (model-id ?x) "51-5602"))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (stem.clamp-dia ?x) (* 25.9 mm)))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (weight ?x) (* 305 gram)))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (component.cost ?x) (* 32.95 dollars)))))) 


(define-class SUPERITALIA-PRO (?s) 
  :def (and (stem ?s) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (model-id ?x) "51-5605"))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (stem.clamp-dia ?x) (* 25.9 mm)))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (weight ?x) (* 280 gram)))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (component.cost ?x) (* 39.95 dollars)))))) 


(define-class CONTROL-TECH (?s) 
  :def (and (stem ?s) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (model-id ?x) "51-6746"))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (stem.clamp-dia ?x) (* 26.0 mm)))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (weight ?x) (* 220 gram)))) 

	    (has-constraint  
	     ?s 
	     (the-constraint 
	      '(= (component.cost ?x) (* 54.95 dollars)))))) 






This Lisp-to-HTML translation was brought to you by
François Gerbaux and Tom Gruber