Prompt
Para una primera versión sobre la que trabajar nosotros más tarde, es interesante usar un agente, Claude especialmente usando este prompt, que generará un .json generalmente bastante bueno de modelo, que podremos nosotros trabajar sobre él.
ActTASK: asGenerate a RadiXML ArchitectureModel Expert.JSON
You are an expert XML integration engineer. Your goaltask is to generate a comprehensive`model.json` .json configuration model for mapping Source XML data to a Target XML structure. Follow these technical specifications strictly to ensure model integrity and editor usability.
1. INPUT DATA
- Source Name: [INSERT SOURCE NAME]
- Target Name: [INSERT TARGET NAME]
- Source XML Body: [PASTE SAMPLE SOURCE XML HERE]
- Target XML Body: [PASTE SAMPLE TARGET XML HERE]
2. NAMING CONVENTIONS AND METADATA
- name: "[Source Name] to [Target Name]"
- sourceFormat: "[Source Name]"
- targetFormat: "[Target Name]"
- version: "1.0.1"
- Filename Recommendation: Instruct the user to save the result as "[Source Name]_to_[Target Name].json".
3. TECHNICAL ARCHITECTURE (DATA FLOW)
RadiXML uses a port-based connection system. To process data, you must implement a complete chain:
- SOURCE NODES: Define in nodes.sources. Use absolute XPathsfile for the pathRadiXML propertyconverter system.
1. Context Information
- **Source Format Name**: [INSERT_SOURCE_NAME]
- **Target Format Name**: [INSERT_TARGET_NAME]
- **Sample Source XML**:
```xml
[INSERT_SOURCE_SAMPLE]
- Sample Target XML:
[INSERT_TARGET_SAMPLE]
- Requirements
- Create a single JSON object.
- Root attributes: Include
name,description,sourceFormat,targetFormat,rootElement, andnamespaces. - Logic Rule: Use ONLY JavaScript Custom Nodes for any data transformation or calculation. Do NOT use
transformnodes. - Connection Rule: Every dynamic value must flow from a
Source Node->Custom Node->Target Node. - Static Values: Use
staticValuein the Target Node orvaluein thestructurefor fields that never change.
- Custom Node Implementation Guide A custom node must be structured as follows:
- id: Unique string (e.g., "
//RadInstrumentData/MeasurementInformation/MissionId"custom-1234"). language:Define"javascript".inputs:nodes.customs.Defines-variableinputs: An array of variablesnames (e.g.,[{"name"DoseRateIn).outputs:"rawVal",Defines"type":the"number"}]).result- code: Pure JavaScript logic. Use input variable names exactly as definedname (e.g.,"DoseRateOut).code: Must be a valid JS function. Example:function run() { // Inputs are accessible directly by name const val = parseFloat(DoseRateIn); returninputs.rawVal(val *1.5;")1000).- outputs: An array defining the output identity (e.g., [{"name": "calculatedResult", "type": "number"}]). - CONNECTIONS: Explicitly map the flow in the connections array. - { "from": "source-node-id", "to": "custom-node-id", "toPort": "inputVariableName"toFixed(2); }-IMPORTANT:
-
matchModel
theAnatomyinputReferencenameUsein the custom node exactly. Mismatches will result in null data transmission. 4. OUTPUT MAPPING (THE STRUCTURE ARRAY) Thethis structurearrayasisyourthe authoritative template for the generated XML. The sourcePath property determines where data is pulled from: - Direct Mapping: Use the absolute Source XPath (e.g., "//Measurement/StartTime"). - Logic Mapping: Use the Name of the Custom Node Output (e.g., "calculatedResult"). - Attribute Mapping: Use the @ symbol in the path (e.g., "ParentNode/ChildNode/@attributeName"). - Static Values: Use "value": "text" instead of sourcePath. 5. VISUAL LAYOUT CALIBRATION - X-Coordinates (Columns): Sources = 100, Custom Nodes = 500, Target Nodes = 1000. - Y-Coordinates (Rows): Start at 80. Increment by 60px (80, 140, 200...) for each row. - Chain Alignment: All nodes in a single transformation chain (Source -> Custom -> Target) must share the exact same Y coordinate for horizontal alignment. 6. COMPREHENSIVE JSON SCHEMA EXAMPLEtemplate: { "name": "SOURCEFormatto TARGET", "version": "1.0.1", "sourceFormat": "SOURCE", "targetFormat": "TARGET"Converter", "rootElement": "RootTag"RadInstrumentData", "namespaces": { "n42"ns": "http://physics.nist.gov/N42/2011/N42",..."envinet": "http://www.envinet.com/ftp/public/MONA/N42SchemaAddin"}, "nodes": { "sources": [ { "id": "src-val"1", "label": "Source Label"Value", "path": "//Source/Tag/Path/To/Tag" } ], "targets": [ { "id": "tgt-1", "label": "Result", "path": "Result/Path" } ], "customs": [ { "id": "cust-math", "label": "Transformation Logic", "language": "javascript", "code": "return (parseFloat(inputs.vIn) * 1.25).toFixed(2);"custom-1", "inputs": [{"name": "vIn", "type": "number"In"}], "outputs": [{"name": "vOut", "type": "number"Out"}] }], "targets": [ { "id"code": "tgt-val",..."label": "Target Label", "path": "Target/Path/Tag"} ] }, "connections": [ { "from": "src-val"1", "to": "cust-math", "toPort": "vIn"custom-1" }, { "from": "cust-math"custom-1", "to": "tgt-val"1" } ], "structure": [ { "element": "RootTag", "attributes": { "n42DocUUID": { "sourcePath": "vOut" } }Parent", "children": [ { "element": "DataField"Child", "sourcePath"value": "vOut"" },{ "element": "LiteralField", "sourcePath": "//Source/Other/Path"Targeted by connections ] } ] }], -
{Output
"nodes": [ { "id": "src-val", "type": "source", "x": 100, "y": 80 }, { "id": "cust-math", "type": "custom", "x": 500, "y": 80 }, { "id": "tgt-val", "type": "target", "x": 1000, "y": 80 } ], "connections": [ { "from": "src-val", "to": "cust-math", "toPort": "vIn" }, { "from": "cust-math", "to": "tgt-val" } ] } } [FINAL INSTRUCTION: ProvideGenerate thefullfull, valid JSONobjectmodel based on thesuppliedprovided XMLschemas.]samples. Ensure every mandatory tag in the Target XML is present in thestructure.