diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ee/souffle/kicad.dl | 147 | ||||
-rw-r--r-- | src/ee/tools/templates/build.ninja.j2 | 6 | ||||
-rw-r--r-- | src/ee/xml/uris.py | 1 |
3 files changed, 118 insertions, 36 deletions
diff --git a/src/ee/souffle/kicad.dl b/src/ee/souffle/kicad.dl index ed9bf4a..3df801f 100644 --- a/src/ee/souffle/kicad.dl +++ b/src/ee/souffle/kicad.dl @@ -4,49 +4,81 @@ .decl add_fact(part_uri:symbol, key:symbol, value:symbol) .output add_fact -/* -.decl is_resistor(uri:symbol) -.decl is_capacitor(uri:symbol) -.decl is_inductor(uri:symbol) +// --------------------------------------------------------------------------------------------------------------------- +// Resistor rules -is_resistor(Ref) :- +.decl resistor_symbol(lib:symbol, name:symbol) + +.decl resistor_lib(lib:symbol) +resistor_lib("Resistor_SMD"). +resistor_lib("Resistor_THT"). + +.decl resistor(uri:symbol) + +resistor(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib), resistor_lib(lib). - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib). -is_capacitor(Ref) :- - capacitor_lib(lib). - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib). +resistor(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name), + resistor_symbol(lib, name). -is_inductor(Ref) :- - inductor_lib(lib). - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib). -*/ +add_fact(Part, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#resistor") :- + resistor(Part). -.decl resistor_lib(name:symbol) -resistor_lib("Resistor_SMD"). -resistor_lib("Resistor_THT"). +// --------------------------------------------------------------------------------------------------------------------- +// Capacitor rules -.decl capacitor_lib(name:symbol) +.decl capacitor_symbol(lib:symbol, name:symbol) + +.decl capacitor_lib(lib:symbol) capacitor_lib("Capacitor_SMD"). -.decl inductor_lib(name:symbol) +.decl capacitor(uri:symbol) + +capacitor(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib), + capacitor_lib(lib). + +capacitor(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name), + capacitor_symbol(lib, name). + +add_fact(Part, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#capacitor") :- + capacitor(Part). + +// --------------------------------------------------------------------------------------------------------------------- +// Inductor rules + +.decl inductor_symbol(lib:symbol, name:symbol) + +.decl inductor_lib(lib:symbol) inductor_lib("Inductor_SMD"). -add_fact(Ref, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#resistor") :- - resistor_lib(lib), - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib). +.decl inductor(uri:symbol) + +inductor(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib), + inductor_lib(lib). + +inductor(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name), + inductor_symbol(lib, name). -add_fact(Ref, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#capacitor") :- - capacitor_lib(lib), - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib). +add_fact(Part, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#inductor") :- + inductor(Part). -add_fact(Ref, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#inductor") :- - inductor_lib(lib), - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#footprint-library", lib). +// --------------------------------------------------------------------------------------------------------------------- +// Net tie rules // 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_lib(lib:symbol) + .decl net_tie_symbol(lib:symbol, name:symbol) net_tie_symbol("Device", "Net-Tie_2"). net_tie_symbol("Device", "Net-Tie_3"). @@ -54,10 +86,24 @@ net_tie_symbol("Device", "Net-Tie_3_Tee"). net_tie_symbol("Device", "Net-Tie_4"). net_tie_symbol("Device", "Net-Tie_4_Cross"). -add_fact(Ref, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#net-tie") :- - net_tie_symbol(lib, name), - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name). +.decl net_tie(uri:symbol) + +net_tie(Part) :- + net_tie_lib(lib), + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib). + +net_tie(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name), + net_tie_symbol(lib, name). + +add_fact(Part, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#net-tie") :- + net_tie(Part). + +// --------------------------------------------------------------------------------------------------------------------- +// Test point rules + +.decl test_point_lib(lib:symbol) .decl test_point_symbol(lib:symbol, name:symbol) test_point_symbol("Connector", "TestPoint"). @@ -66,7 +112,38 @@ test_point_symbol("Connector", "TestPoint_Alt"). test_point_symbol("Connector", "TestPoint_Flag"). test_point_symbol("Connector", "TestPoint_Probe"). -add_fact(Ref, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#test-point") :- - test_point_symbol(lib, name), - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), - fact(Ref, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name). +.decl test_point(uri:symbol) + +test_point(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + test_point_lib(lib). + +test_point(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name), + test_point_symbol(lib, name). + +add_fact(Part, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#test-point") :- + test_point(Part). + +// --------------------------------------------------------------------------------------------------------------------- +// Mounting hole rules + +.decl mounting_hole_lib(lib:symbol) + +.decl mounting_hole_symbol(lib:symbol, name:symbol) +mounting_hole_symbol("Mechanical", "MountingHole"). + +.decl mounting_hole(uri:symbol) + +mounting_hole(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + mounting_hole_lib(lib). + +mounting_hole(Part) :- + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-library", lib), + fact(Part, "http://purl.org/ee/kicad-sch-fact-type#symbol-name", name), + mounting_hole_symbol(lib, name). + +add_fact(Part, "http://purl.org/ee/fact-type/ee-component-type", "http://purl.org/ee/part-type#mounting-hole") :- + mounting_hole(Part). diff --git a/src/ee/tools/templates/build.ninja.j2 b/src/ee/tools/templates/build.ninja.j2 index e8ce404..5c94d3e 100644 --- a/src/ee/tools/templates/build.ninja.j2 +++ b/src/ee/tools/templates/build.ninja.j2 @@ -34,7 +34,11 @@ rule part-apply-souffle-pre command = $ee part-apply-souffle-pre {{ log }} --in $in --work $work rule souffle - command = souffle -F $work/in -D $work/out -I $work -I "{{ souffle_ee_src }}" $in + command = souffle $ + -F $work/in -D $work/out $ + --no-warn $ + -I $work $ + -I "{{ souffle_ee_src }}" $in rule part-apply-souffle-post command = $ee part-apply-souffle-post {{ log }} --in $in_sch --out $out --work $work diff --git a/src/ee/xml/uris.py b/src/ee/xml/uris.py index d2e3f5b..97c3fa3 100644 --- a/src/ee/xml/uris.py +++ b/src/ee/xml/uris.py @@ -11,6 +11,7 @@ TRANSISTOR = "http://purl.org/ee/part-type#transistor" NET_TIE = "http://purl.org/ee/part-type#net-tie" TEST_POINT = "http://purl.org/ee/part-type#test-point" +MOUNTING_HOLE = "http://purl.org/ee/part-type#mounting-hole" _DIGIKEY_FACT_KEY_PREFIX = "http://purl.org/ee/digikey-fact-key#" |