From 50e1475eb6e1200365e0fca40ba73847ad70e440 Mon Sep 17 00:00:00 2001
From: Trygve Laugstøl <trygvis@inamo.no>
Date: Thu, 30 May 2019 08:29:51 +0200
Subject: digikey.dl/kicad.dl: more rules.

---
 src/ee/souffle/digikey.dl | 13 +++++++++++++
 src/ee/souffle/kicad.dl   |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/src/ee/souffle/digikey.dl b/src/ee/souffle/digikey.dl
index f5088fb..5073e4d 100644
--- a/src/ee/souffle/digikey.dl
+++ b/src/ee/souffle/digikey.dl
@@ -6,7 +6,9 @@
 #define CAPACITANCE "http://purl.org/ee/digikey-fact-key#2049"
 #define SURFACE_MOUNT_LAND_SIZE "http://purl.org/ee/digikey-fact-key#884"
 #define PACKAGE "http://purl.org/ee/digikey-fact-key#16"
+#define SUPPLIER_DEVICE_PACKAGE "http://purl.org/ee/digikey-fact-key#1291"
 #define MOUNTING_TYPE "http://purl.org/ee/digikey-fact-key#69"
+#define BASE_PART_TYPE "http://purl.org/ee/digikey-fact-key#2078"
 
 /*
 I though this rule would be good enough, but I keep on getting errors like this:
@@ -24,6 +26,7 @@ fact(part, "http://purl.org/ee/fact-type/footprint", res) :-
 .decl dk_to_ipc(dk:symbol, ipc:symbol)
 
 dk_to_ipc("0402 (1005 Metric)", "1005").
+dk_to_ipc("0402 (1006 Metric)", "1005"). // compatible enough
 dk_to_ipc("0805 (2012 Metric)", "2012").
 dk_to_ipc("1206 (3216 Metric)", "3216").
 dk_to_ipc("1812 (4532 Metric)", "4532").
@@ -31,3 +34,13 @@ dk_to_ipc("1812 (4532 Metric)", "4532").
 fact(part, "http://purl.org/ee/fact-type/footprint", ipc) :-
     fact(part, "http://purl.org/ee/digikey-fact-key#16", dk),
     dk_to_ipc(dk, ipc).
+
+.decl supplier_device_package_to_footprint(dk:symbol, footprint:symbol)
+
+supplier_device_package_to_footprint("Mini-Dip (TO-269AA)", "TO-269AA").
+supplier_device_package_to_footprint("SMA (DO-214AC)", "SMA").
+supplier_device_package_to_footprint("SOD-323", "SOD-323").
+
+fact(part, "http://purl.org/ee/fact-type/footprint", footprint) :-
+    fact(part, SUPPLIER_DEVICE_PACKAGE, dk),
+    supplier_device_package_to_footprint(dk, footprint).
diff --git a/src/ee/souffle/kicad.dl b/src/ee/souffle/kicad.dl
index e01cefe..f176dd4 100644
--- a/src/ee/souffle/kicad.dl
+++ b/src/ee/souffle/kicad.dl
@@ -43,6 +43,9 @@ fact(Ref, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/
     inductor_lib(lib),
     fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib).
 
+// Net ties and test points should probably not be marked as components to buy. Test points is possible to buy and
+// install so that needs to be an option.
+
 .decl net_tie_symbol(lib:symbol, name:symbol)
 net_tie_symbol("Device", "Net-Tie_2").
 net_tie_symbol("Device", "Net-Tie_3").
-- 
cgit v1.2.3