diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2017-01-07 14:00:46 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2017-01-07 14:00:46 +0100 |
commit | 0958273a71dd19c2a90471a182ccc5b90b14e5b4 (patch) | |
tree | 8e33385ca9df94b80ce9b1f8ba06438b807f137a /trygvis/eda/cli/make_bom.py | |
parent | 5d7fc9c4b14536006f2435b1379887f95937e096 (diff) | |
download | eda-rdf-0958273a71dd19c2a90471a182ccc5b90b14e5b4.tar.gz eda-rdf-0958273a71dd19c2a90471a182ccc5b90b14e5b4.tar.bz2 eda-rdf-0958273a71dd19c2a90471a182ccc5b90b14e5b4.tar.xz eda-rdf-0958273a71dd19c2a90471a182ccc5b90b14e5b4.zip |
Renaming 'schematic' to 'project'.
Renaming 'kicad-bom-to-ttl' to 'kicad-import-project'.
Renaming 'digikey-download-for-schematic' to 'digikey-download-for-project'.
Splitting out the Export xml file code into its own module.
init: putting project.url and project.file in config.ini.
init: putting db.update-url in config.ini if given on the command line.
kicad-import-project: by default, assume that the user want to update local database, optionally write the ttl file to disk.
cli.write_graph: create any missing parent directories.
Diffstat (limited to 'trygvis/eda/cli/make_bom.py')
-rwxr-xr-x | trygvis/eda/cli/make_bom.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/trygvis/eda/cli/make_bom.py b/trygvis/eda/cli/make_bom.py index 7805ead..a47e04a 100755 --- a/trygvis/eda/cli/make_bom.py +++ b/trygvis/eda/cli/make_bom.py @@ -22,11 +22,11 @@ class Component(object): self.fields[field_name] = field_value -def run(schematic_url): - cli.with_database(lambda g: work(schematic_url, g)) +def run(project_url): + cli.with_database(lambda g: work(project_url, g)) -def work(schematic_url, g): +def work(project_url, g): components = {} dk_parts = {} @@ -36,14 +36,14 @@ def work(schematic_url, g): SELECT ?ref ?value WHERE { - ?schematic a kicad-type:schematic ; + ?project a kicad-type:project ; kicad:component ?cmp . ?cmp a kicad-type:schematic_component ; kicad:value ?value ; rdfs:label ?ref . } ORDER BY ?ref -""", init_bindings={"schematic": rdflib.URIRef(schematic_url)}) +""", init_bindings={"project": rdflib.URIRef(project_url)}) for row in res: c = Component(row.ref, row.value) @@ -55,7 +55,7 @@ ORDER BY ?ref SELECT ?ref ?field ?field_name ?field_value WHERE { - ?schematic a kicad-type:schematic ; + ?project a kicad-type:project ; kicad:component ?cmp . ?cmp a kicad-type:schematic_component ; rdfs:label ?ref ; @@ -64,7 +64,7 @@ WHERE { ?field a kicad-type:field ; kicad:field_value ?field_value . } ORDER BY ?ref ?field_name -""", init_bindings={"schematic": rdflib.URIRef(schematic_url)}) +""", init_bindings={"project": rdflib.URIRef(project_url)}) for row in res: c = components[row.ref] @@ -72,12 +72,12 @@ ORDER BY ?ref ?field_name c.set_field(row.field_name, row.field_value) cli.info('%5s: %-20s %s' % (c.ref, row.field_name + ':', row.field_value)) - cli.info("Loading Digi-Key parts for schematic") + cli.info("Loading Digi-Key parts for project") res = cli.sparql(g, """ SELECT ?ref ?part_number ?type ?value ?attr_type WHERE { - ?schematic kicad:component ?cmp . + ?project kicad:component ?cmp . ?cmp a kicad-type:schematic_component ; rdfs:label ?ref ; kicad:field ?d . @@ -93,7 +93,7 @@ WHERE { dk:value ?attr_value . } ORDER BY ?ref ?attr_type ?attr_value -""", init_bindings={"schematic": rdflib.URIRef(schematic_url)}) +""", init_bindings={"project": rdflib.URIRef(project_url)}) for row in res: pn = row.part_number @@ -113,7 +113,7 @@ SELECT ?ref ?footprint ?part_number ?package_value ?case_value # * WHERE { - ?schematic kicad:component ?cmp . + ?project kicad:component ?cmp . ?cmp a kicad-type:schematic_component ; rdfs:label ?ref ; kicad:field ?dk_field . @@ -138,12 +138,12 @@ WHERE { # ?case_type a dk:attributeType ; dk:value ?case_url . # } . -# VALUES (?schematic_url) { (<https://trygvis/purl/kicad-board#SweetZpot+Sensor>) } . +# VALUES (?project_url) { (<https://trygvis/purl/kicad-board#SweetZpot+Sensor>) } . # VALUES (?package_type) { (dk-attr-type:pv16) } . # VALUES (?case_type) { (dk-attr-type:pv1291) } . } ORDER BY ?ref -""", init_bindings={"schematic": rdflib.URIRef(schematic_url), +""", init_bindings={"project": rdflib.URIRef(project_url), "package_type": digikey_rdf.DIGIKEY_ATTRIBUTE_TYPE["pv16"], "cast_type": digikey_rdf.DIGIKEY_ATTRIBUTE_TYPE["pv1291"]}) |