Skip to main content

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.

Act as a RadiXML Architecture Expert. Your goal is to generate a comprehensive .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 XPaths for the path property (e.g., "//RadInstrumentData/MeasurementInformation/MissionId").
- CUSTOM NODES (LOGIC): Define in nodes.customs.
    - inputs: An array of variables (e.g., [{"name": "rawVal", "type": "number"}]).
    - code: Pure JavaScript logic. Use input variable names exactly as defined (e.g., "return inputs.rawVal * 1.5;").
    - 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" }
    - IMPORTANT: The toPort must match the input name in the custom node exactly. Mismatches will result in null data transmission.

### 4. OUTPUT MAPPING (THE STRUCTURE ARRAY)
The structure array is the 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 EXAMPLE
{
  "name": "SOURCE to TARGET",
  "version": "1.0.1",
  "sourceFormat": "SOURCE",
  "targetFormat": "TARGET",
  "rootElement": "RootTag",
  "namespaces": {
    "n42": "http://physics.nist.gov/N42/2011/N42",
    "envinet": "http://www.envinet.com/ftp/public/MONA/N42SchemaAddin"
  },
  "nodes": {
    "sources": [
      { "id": "src-val", "label": "Source Label", "path": "//Source/Tag/Path" }
    ],
    "customs": [
      {
        "id": "cust-math",
        "label": "Transformation Logic",
        "language": "javascript",
        "code": "return (parseFloat(inputs.vIn) * 1.25).toFixed(2);",
        "inputs": [ { "name": "vIn", "type": "number" } ],
        "outputs": [ { "name": "vOut", "type": "number" } ]
      }
    ],
    "targets": [
      { "id": "tgt-val", "label": "Target Label", "path": "Target/Path/Tag" }
    ]
  },
  "connections": [
    { "from": "src-val", "to": "cust-math", "toPort": "vIn" },
    { "from": "cust-math", "to": "tgt-val" }
  ],
  "structure": [
    {
      "element": "RootTag",
      "attributes": {
        "n42DocUUID": { "sourcePath": "vOut" }
      },
      "children": [
        { "element": "DataField", "sourcePath": "vOut" },
        { "element": "LiteralField", "sourcePath": "//Source/Other/Path" }
      ]
    }
  ],
  "visualModel": {
    "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: Provide the full JSON object based on the supplied XML schemas.]