### Import and Use FPB-OWL-Mapper in JavaScript/TypeScript Source: https://github.com/hsu-aut/fpb-owl-mapper/blob/main/README.md Import the map function from the fpb-owl-mapper library to convert FPB JSON models within your project. This example reads a JSON file, parses it, and then maps it to an ontology. ```javascript import { map } from "fpb-owl-mapper"; import * as fs from "fs" // In this case, the model is read from file. Of course, you could also have a model in your application const file = fs.readFileSync("./exampleProcess.json") const fpbJson = JSON.parse(file.toString()) const res = map(fpbJson); console.log(res); // Output will be a long string with the transformed model in .ttl syntax ``` -------------------------------- ### Generate OWL Ontology in Turtle Format Source: https://context7.com/hsu-aut/fpb-owl-mapper/llms.txt Example of the generated OWL ontology in Turtle (.ttl) syntax. This output includes prefixes, ontology definitions, and individual definitions for process elements and their relationships, importing the VDI3682 ontology. ```turtle # Example output for a simple two-stage manufacturing process @prefix VDI3682: . @prefix in: . rdf:type owl:Ontology ; owl:imports . # Process definition a VDI3682:Process. # Process operators with inputs/outputs in:1 a VDI3682:ProcessOperator. VDI3682:consistsOf in:1. in:1 VDI3682:hasInput . in:1 VDI3682:hasOutput in:myTestName. # Technical resources and assignments in:TR1 a VDI3682:TechnicalResource. in:1 VDI3682:isAssignedTo in:TR1. # State elements (products, energy, information) a VDI3682:Product. in:myTestName a VDI3682:Product. # Process inputs/outputs on system limit VDI3682:hasInput . VDI3682:hasOutput in:myTestName. # System limit a VDI3682:SystemLimit. VDI3682:consistsOf . # Decomposed process operators (hierarchical processes) in:1 VDI3682:isComposedOf in:2. in:1 VDI3682:isComposedOf in:3. ``` -------------------------------- ### Run FPB-OWL-Mapper as CLI Source: https://github.com/hsu-aut/fpb-owl-mapper/blob/main/README.md Use this command in your terminal to map a JSON FPB file to an ontology. Specify the file path, namespace, and ontology IRI. ```bash node fpb2owl-cli.js map "filePath" -n "Namespace" -o "ontologyIri" ``` -------------------------------- ### FPB OWL Mapper CLI Usage (Bash) Source: https://context7.com/hsu-aut/fpb-owl-mapper/llms.txt Command-line interface for mapping FPB JSON to OWL ontologies. Supports specifying input file, custom namespace, and custom ontology IRI using short or long option names. ```bash # Basic usage with required file path node fpb2owl-cli.js map "./myProcess.json" ``` ```bash # With custom namespace for all individuals node fpb2owl-cli.js map "./myProcess.json" -n "http://www.mycompany.com/processes#" ``` ```bash # With custom namespace and ontology IRI node fpb2owl-cli.js map "./myProcess.json" \ -n "http://www.mycompany.com/processes#" \ -o "http://www.mycompany.com/ontologies/manufacturing-process" ``` ```bash # Using long option names node fpb2owl-cli.js map "./myProcess.json" \ --namespace "http://www.mycompany.com/processes#" \ --ontologyIri "http://www.mycompany.com/ontologies/manufacturing-process" ``` ```bash # Show help node fpb2owl-cli.js --help ``` -------------------------------- ### CLI Usage Source: https://context7.com/hsu-aut/fpb-owl-mapper/llms.txt Command-line interface for mapping FPB JSON files to OWL ontologies without writing code. ```APIDOC ## CLI: fpb2owl-cli.js map ### Description Reads an input FPB JSON file and outputs a mapped-ontology.ttl file. ### Parameters #### Query Parameters - **filePath** (string) - Required - Path to the input JSON file. - **-n, --namespace** (string) - Optional - Custom namespace for all individuals. - **-o, --ontologyIri** (string) - Optional - Custom ontology IRI. ### Response - **File** - Generates 'mapped-ontology.ttl' in the current directory. ``` -------------------------------- ### Convert fpb.js Export to OWL Ontology Source: https://context7.com/hsu-aut/fpb-owl-mapper/llms.txt Load a JSON export from fpb.js, define a custom namespace and ontology IRI, then use the 'map' function to transform it into an OWL ontology in Turtle format. Save the generated ontology for use with semantic web tools. ```typescript import { map } from "fpb-owl-mapper"; import * as fs from "fs"; // Workflow: fpb.js export -> fpb-owl-mapper -> semantic reasoning // 1. Load exported model from fpb.js const fpbExport = JSON.parse(fs.readFileSync("./fpbjs-export.json").toString()); // 2. Define custom namespace for your organization const namespace = "http://www.mycompany.com/manufacturing/processes#"; const ontologyIri = "http://www.mycompany.com/manufacturing/ontology"; // 3. Transform to OWL ontology const owlOntology = map(fpbExport, namespace, ontologyIri); // 4. Save for use with semantic web tools (Protégé, SPARQL endpoints, etc.) fs.writeFileSync("./manufacturing-process.ttl", owlOntology); ``` -------------------------------- ### Map FPB JSON to OWL Ontology (TypeScript) Source: https://context7.com/hsu-aut/fpb-owl-mapper/llms.txt Use the `map` function to convert FPB JSON models to OWL ontologies. Supports default and custom namespaces and ontology IRIs. Requires reading the JSON file and writing the output. ```typescript import { map } from "fpb-owl-mapper"; import * as fs from "fs"; // Read FPB JSON model from file const file = fs.readFileSync("./exampleProcess.json"); const fpbJson = JSON.parse(file.toString()); // Map with default namespace and ontology IRI const ontologyDefault = map(fpbJson); console.log(ontologyDefault); // Output: // @prefix VDI3682: . // @prefix in: // // rdf:type owl:Ontology ; // owl:imports . // // a VDI3682:Process. // in:process a VDI3682:ProcessOperator. // ... // Map with custom namespace and ontology IRI const customNamespace = "http://www.mycompany.com/ontologies#"; const customOntologyIri = "http://www.mycompany.com/ontologies/my-process"; const ontologyCustom = map(fpbJson, customNamespace, customOntologyIri); // Write the result to a file fs.writeFileSync("./output-ontology.ttl", ontologyCustom); ``` -------------------------------- ### Define FPB JSON Model Structure (TypeScript) Source: https://context7.com/hsu-aut/fpb-owl-mapper/llms.txt Defines the TypeScript interface for an FPB JSON model, which includes project metadata and process container details. This structure is used as input for the fpb-owl-mapper. ```typescript import { FpbJsModel, ProcessContainer, ProcessOperator, Product, Energy, Information } from "fpb-owl-mapper"; // Example FPB JSON model structure const fpbModel: FpbJsModel = [ // Optional project metadata { "$type": "fpb:Project", "name": "Manufacturing Process", "targetNamespace": "http://example.org/processes", "entryPoint": "process-1" }, // Process container with all process elements { "process": { "$type": "fpb:Process", "id": "process-1", "name": "AssemblyProcess", "elementsContainer": ["op-1", "prod-1", "prod-2"], "isDecomposedProcessOperator": null, "consistsOfStates": ["prod-1", "prod-2"], "consistsOfSystemLimit": "sl-1", "consistsOfProcessOperator": ["op-1"], "consistsOfProcesses": [] }, "elementDataInformation": [ { "$type": "fpb:ProcessOperator", "id": "op-1", "name": "Assemble", "identification": { "$type": "fpb:Identification", "uniqueIdent": "OP001", "longName": "Assembly Operation", "shortName": "Assemble", "versionNumber": "1", "revisionNumber": "0" }, "incoming": ["flow-1"], "outgoing": ["flow-2"], "isAssignedTo": ["tr-1"] }, { "$type": "fpb:Product", "id": "prod-1", "name": "RawMaterial", "identification": { "$type": "fpb:Identification", "uniqueIdent": "P001", "longName": "Raw Material", "shortName": "Raw", "versionNumber": "1", "revisionNumber": "0" }, "incoming": [], "outgoing": ["flow-1"], "isAssignedTo": [] }, { "$type": "fpb:Product", "id": "prod-2", "name": "FinishedPart", "identification": { "$type": "fpb:Identification", "uniqueIdent": "P002", "longName": "Finished Part", "shortName": "Part", "versionNumber": "1", "revisionNumber": "0" }, "incoming": ["flow-2"], "outgoing": [], "isAssignedTo": [] }, { "$type": "fpb:TechnicalResource", "id": "tr-1", "name": "AssemblyRobot", "identification": { "$type": "fpb:Identification", "uniqueIdent": "TR001", "longName": "Assembly Robot", "shortName": "Robot", "versionNumber": "1", "revisionNumber": "0" }, "incoming": [], "outgoing": [], "isAssignedTo": ["op-1"] }, { "$type": "fpb:Flow", "id": "flow-1", "sourceRef": "prod-1", "targetRef": "op-1" }, { "$type": "fpb:Flow", "id": "flow-2", "sourceRef": "op-1", "targetRef": "prod-2" }, { "$type": "fpb:SystemLimit", "id": "sl-1", "elementsContainer": ["op-1", "prod-1", "prod-2"] } ], "elementVisualInformation": [] } ]; // Use the model import { map } from "fpb-owl-mapper"; const ontology = map(fpbModel); ``` -------------------------------- ### map Function Source: https://context7.com/hsu-aut/fpb-owl-mapper/llms.txt The core TypeScript function used to convert an FPB JSON model into an OWL ontology. ```APIDOC ## map(fpbJson, namespace?, ontologyIri?) ### Description Converts an FPB JSON model exported from fpb.js into an OWL ontology in Turtle syntax. ### Parameters #### Request Body - **fpbJson** (object) - Required - The FPB JSON model object. - **namespace** (string) - Optional - Custom namespace for the generated individuals. - **ontologyIri** (string) - Optional - Custom IRI for the ontology. ### Response - **string** - The resulting OWL ontology in Turtle (.ttl) format. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.