Skip to content

Commit

Permalink
fix: entry point
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <danscode@selman.org>
  • Loading branch information
dselman committed Dec 12, 2023
1 parent f71caa5 commit b032a0c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@accordproject/concerto-graph",
"version": "1.0.0",
"description": "Concerto Graph",
"main": "dist/graphmodel.js",
"main": "dist/src/graphmodel.js",
"license": "Apache-2.0",
"scripts": {
"prebuild": "npx eslint src/**/*.ts",
Expand Down
19 changes: 15 additions & 4 deletions src/demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const MODEL = `
namespace ${NS}
import org.accordproject.graph@1.0.0.{GraphNode}
// show how a complex type gets flattened
concept Address {
o String line1
o String line2 optional
Expand All @@ -16,6 +15,12 @@ concept Address {
o String country
}
// show how a complex type gets flattened
concept ContactDetails {
o Address address
o String email
}
// show how maps get flattened
scalar PersonName extends String
scalar PersonEmail extends String
Expand All @@ -38,7 +43,7 @@ concept Director extends Person {
}
concept User extends Person {
o Address address
o ContactDetails contactDetails
o AddressBook addressBook
@label("RATED")
--> Movie[] ratedMovies optional
Expand Down Expand Up @@ -81,8 +86,14 @@ async function run() {
state: 'CO',
country: 'USA'
};
const contactDetails = {
$class: 'demo.graph@1.0.0.ContactDetails',
address,
email: 'dan@example.com'
};
const addressBook = {
'Dan' : 'dan@example.com'
'Dan' : 'dan@example.com',
'Isaac' : 'isaac@example.com'
};
await graphModel.mergeNode(transaction, 'Movie', {identifier: 'Brazil', summary: 'The film centres on Sam Lowry, a low-ranking bureaucrat trying to find a woman who appears in his dreams while he is working in a mind-numbing job and living in a small apartment, set in a dystopian world in which there is an over-reliance on poorly maintained (and rather whimsical) machines'} );
await graphModel.mergeNode(transaction, 'Movie', {identifier: 'The Man Who Killed Don Quixote', summary: 'Instead of a literal adaptation, Gilliam\'s film was about "an old, retired, and slightly kooky nobleman named Alonso Quixano".'} );
Expand All @@ -101,7 +112,7 @@ async function run() {
await graphModel.mergeRelationship(transaction, 'Director', 'Terry Gilliam', 'Movie', 'The Man Who Killed Don Quixote', 'directed' );
await graphModel.mergeRelationship(transaction, 'Director', 'Terry Gilliam', 'Movie', 'Fear and Loathing in Las Vegas', 'directed' );

await graphModel.mergeNode(transaction, 'User', {identifier: 'Dan', address, addressBook} );
await graphModel.mergeNode(transaction, 'User', {identifier: 'Dan', contactDetails, addressBook} );
await graphModel.mergeRelationship(transaction, 'User', 'Dan', 'Movie', 'Brazil', 'ratedMovies' );

await graphModel.mergeNode(transaction, 'Actor', {identifier: 'Jonathan Pryce'} );
Expand Down

0 comments on commit b032a0c

Please sign in to comment.