This repository was archived by the owner on Feb 27, 2025. It is now read-only.
-
Couldn't load subscription status.
- Fork 0
Storebindings #19
Open
mattdfuchs
wants to merge
16
commits into
master
Choose a base branch
from
storebindings
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Storebindings #19
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
e863c43
moving stuff out of the way
c3083a7
bindings in store, find items needing a binding
b0f1bd4
minor changes from moving N3Store version
6e6097c
generalized framework for plugins, fixes for CIM (at least) round trip
edfb26c
sped up export - still some minor inconsistencies for CIM
62550da
merge with master
d6acb25
changes for merge with master
55c9294
Merge branch 'master' into storebindings
mattdfuchs f1b98b6
bindings in store, find items needing a binding
65bcf8f
Frst version of the full API model importer
antoniogarrote dcd9053
Fixing duplication @ids in CIM by generating unique entity UUIDs conc…
antoniogarrote 24cbf3c
sped up export - still some minor inconsistencies for CIM
efc0cea
changes for merge with master
0adde57
trying to integrate api's into store
a29ce2e
stashing changes because their not in master yet to pull antonio's up…
a9f1c60
changes to support API bindings
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,19 @@ | ||
| import * as meta from "@api-modeling/api-modeling-metadata"; | ||
| import { schPref, DataStore } from '@api-modeling/metadata-store' | ||
|
|
||
| import { v4 as uuidv4 } from 'uuid'; | ||
| import { NamedNode,DataFactory } from 'n3'; | ||
| const { namedNode, literal } = DataFactory; | ||
|
|
||
| const rdfType : NamedNode = namedNode(schPref.rdf + 'type') | ||
| const df : DataStore = DataStore.getDataStore() | ||
|
|
||
| /** | ||
| * Some external resource plugins will work with. Just a URL identifying the resource and the text of the resource. | ||
| */ | ||
| export interface Resource { | ||
| url: string | ||
| text: string | ||
| text?: string | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can you get or generate a resource without data? |
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -16,10 +24,12 @@ export interface ConfigurationParameter { | |
| value: any | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Common interface for all bindings plugins | ||
| */ | ||
| export abstract class BindingsPlugin { | ||
| constructor(){} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? |
||
| /** | ||
| * Imports resources into DialectWrappers containing the native model graphs | ||
| * @param configuration | ||
|
|
@@ -33,4 +43,35 @@ export abstract class BindingsPlugin { | |
| * @param graphs | ||
| */ | ||
| abstract async export(configuration: ConfigurationParameter[], graphs: meta.DialectWrapper[]): Promise<Resource[]> | ||
|
|
||
| abstract updateBindings(bindName : string): void | ||
| abstract initBindings(bindUuid: string): string | ||
|
|
||
| private bindName = namedNode(schPref.bind + 'Binding') | ||
| private uuidName = namedNode(schPref.amldata + 'uuid') | ||
| private bdsName = namedNode(schPref.bind + 'bindingDeclarationSource') | ||
| private bsName = namedNode(schPref.bind + 'bindingSource') | ||
| private bbName = namedNode(schPref.bind + 'boundBy') | ||
| private bName = namedNode(schPref.bind + 'binding') | ||
| protected dde = namedNode('http://a.ml/vocabularies/meta#DialectDomainElement') | ||
| protected de = namedNode('http://a.ml/vocabularies/document#DomainElement') | ||
|
|
||
| createBinding(regime: string, bindingDeclSrc: string, source : string){ | ||
| let uuid = uuidv4() | ||
| let bindName = 'http://mulesoft.com/modeling/bindings/' + uuid | ||
| let bindNode = namedNode(bindName) | ||
| let sourceNode = namedNode('http://mulesoft.com/modeling/instances/uuid/'+source) | ||
| let graph = namedNode(regime) | ||
| let bindingDeclarationSource = namedNode(bindingDeclSrc) | ||
| let stupid = `file://${process.cwd()}/node_modules/@api-modeling/api-modeling-metadata/model/bindings/schema/modelBindingsDialect.yaml#/declarations/Binding` | ||
| df.store.addQuad(bindNode, rdfType, namedNode(bindName),graph) | ||
| df.store.addQuad(bindNode, rdfType, this.dde,graph) | ||
| df.store.addQuad(bindNode, rdfType, this.de,graph) | ||
| df.store.addQuad(bindNode, rdfType, namedNode(stupid), graph) | ||
| df.store.addQuad(bindNode,this.uuidName, literal(uuid), graph) | ||
| df.store.addQuad(bindNode, this.bsName, sourceNode, graph) | ||
| df.store.addQuad(bindNode, this.bdsName, namedNode(bindingDeclSrc), graph) | ||
| return bindName | ||
| } | ||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Model-bindings cannot depend on the metadata-store