From 0958273a71dd19c2a90471a182ccc5b90b14e5b4 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 7 Jan 2017 14:00:46 +0100 Subject: 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. --- trygvis/eda/cli/make_bom.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'trygvis/eda/cli/make_bom.py') 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) { () } . +# VALUES (?project_url) { () } . # 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"]}) -- cgit v1.2.3