@ -15,7 +15,8 @@ global.WebSocket = WebSocket;
let config = {
let config = {
server _peer _id : "FtdzuDYGewfXWdoPuXIPb0wnd0SAg1WoA2B14S7jW3MA" ,
server _peer _id : "FtdzuDYGewfXWdoPuXIPb0wnd0SAg1WoA2B14S7jW3MA" ,
admin _user _key : "pye0YFzk1ix1amKEwd6AeqaUAN_PNpH5zGLomh0M1PAA" ,
admin _user _key : "pye0YFzk1ix1amKEwd6AeqaUAN_PNpH5zGLomh0M1PAA" ,
client _peer _key : "GRP0QnlzaB8o2vdiBaNoOYDNOFX-uehLZMxeCaG3JA0A"
client _peer _key : "GRP0QnlzaB8o2vdiBaNoOYDNOFX-uehLZMxeCaG3JA0A" ,
server _addr : "127.0.0.1:14400"
} ;
} ;
ng . init _headless ( config ) . then ( async ( ) => {
ng . init _headless ( config ) . then ( async ( ) => {
@ -24,7 +25,9 @@ ng.init_headless(config).then( async() => {
//let user_id = await ng.admin_create_user(config);
//let user_id = await ng.admin_create_user(config);
//console.log("user created: ",user_id);
//console.log("user created: ",user_id);
let user _id = "tJVG293o6xirl3Ys5rzxMgdnPE_1d3IPAdrlR5qGRAIA" ;
let user _id = "NnAJWxO-KapuWyCm7RGwO5VszZwaJARGit-i3i1mXbkA" ;
let base = "did:ng:o:8mqfhoSprneBjkAASinRk0OYvFpbiyhjMBVHKQIarDEA:v:dmn9xLARD-LrCz1tdmRiTKelikOCadGEvsLklUrwee4A" ;
let session = await ng . session _headless _start ( user _id ) ;
let session = await ng . session _headless _start ( user _id ) ;
session _id = session . session _id ;
session _id = session . session _id ;
@ -33,38 +36,55 @@ ng.init_headless(config).then( async() => {
let dump = await ng . rdf _dump ( session . session _id ) ;
let dump = await ng . rdf _dump ( session . session _id ) ;
console . log ( dump ) ;
console . log ( dump ) ;
let sparql _result = await ng . sparql _query ( session . session _id , "SELECT ?s ?p ?o WHERE { ?s ?p ?o }" ) ;
console . log ( "******** SELECT" )
let sparql _result = await ng . sparql _query ( session . session _id , "SELECT ?s ?p ?o WHERE { ?s ?p ?o }" , base ) ;
console . log ( sparql _result ) ;
console . log ( sparql _result ) ;
for ( const q of sparql _result . results . bindings ) {
for ( const q of sparql _result . results . bindings ) {
console . log ( q ) ;
console . log ( q ) ;
}
}
let history = await ng . branch _history ( session . session _id ) ;
// let history = await ng.branch_history(session.session_id);
for ( const h of history . history ) {
// for (const h of history.history) {
console . log ( h [ 0 ] , h [ 1 ] ) ;
// console.log(h[0], h[1]);
}
// }
console . log ( history . swimlane _state ) ;
// console.log(history.swimlane_state);
//await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:o:8mqfhoSprneBjkAASinRk0OYvFpbiyhjMBVHKQIarDEA> <did:ng:i> <did:ng:j> }");
// await ng.sparql_update(session.session_id, "DELETE DATA { <did:ng:t:AJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE> <did:ng:i> <did:ng:j> }");
// await ng.sparql_update(session.session_id, "DELETE DATA { <did:ng:t:AJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE> <did:ng:i> <did:ng:j> }");
// await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:t:AJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE> <did:ng:i> <did:ng:j> }");
// await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:t:AJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE> <did:ng:i> <did:ng:j> }");
// await ng.sparql_update(session.session_id, "INSERT { ?s <did:ng:i> <did:ng:k> } WHERE { ?s <did:ng:i> <did:ng:j> } ");
// await ng.sparql_update(session.session_id, "INSERT { ?s <did:ng:i> <did:ng:k> } WHERE { ?s <did:ng:i> <did:ng:j> } ");
// await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:z> <did:ng:j> <did:ng:t:BJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE>. <did:ng:t:BJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE> <did:ng:m> <did:ng:n> }");
// await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:z> <did:ng:j> <did:ng:t:BJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE>. <did:ng:t:BJQ5gCLoXXjalC9diTDCvxxWu5ZQUcYWEE821nhVRMcE> <did:ng:m> <did:ng:n> }");
//await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:z> <did:ng:j> [ <did:ng:m> <did:ng:n> ]. }");
//await ng.sparql_update(session.session_id, "INSERT DATA { [ <did:ng:m> <did:ng:n> ] <did:ng:ok> <did:ng:v> . }");
//await ng.sparql_update(session.session_id, "INSERT { ?a <did:ng:ok> <did:ng:v> . } WHERE { ?a <did:ng:m> <did:ng:n> } ");
//await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:z> <did:ng:j> _:1 . _:1 <did:ng:m> <did:ng:n>. }");
//await ng.sparql_update(session.session_id, "INSERT DATA { _:f766ca988268ddc60315ddd5bd621387 <did:ng:o> <did:ng:>. }");
//await ng.sparql_update(session.session_id, "INSERT { _:_ <did:ng:ok> <did:ng:v> . } WHERE { _:_ <did:ng:m> <did:ng:n> } ");
//await ng.sparql_update(session.session_id, "INSERT DATA { _:_ <abc:a> <d:a> . _:_a <abceee:a> <d:a> . }");
sparql _result = await ng . sparql _query ( session . session _id , "SELECT ?a WHERE { ?a <did:ng:j> _:abc. _:abc <did:ng:m> <did:ng:n> }" ) ;
//await ng.sparql_update(session.session_id, "INSERT DATA { <> <a:self> <a:self> . }",base);
await ng . sparql _update ( session . session _id , "INSERT DATA { <did:ng:TEST3> <did:ng:j> _:_ . _:_ <did:ng:m> <did:ng:n> . }" , base ) ;
await ng . sparql _update ( session . session _id , "INSERT DATA { <did:ng:TEST4> <did:ng:j> [ <did:ng:m> <did:ng:n> ]. }" , base ) ;
sparql _result = await ng . sparql _query ( session . session _id , "SELECT ?a WHERE { ?a <did:ng:j> _:abc. _:abc <did:ng:m> <did:ng:n> }" , base ) ;
console . log ( sparql _result ) ;
console . log ( sparql _result ) ;
for ( const q of sparql _result . results . bindings ) {
for ( const q of sparql _result . results . bindings ) {
console . log ( q ) ;
console . log ( q ) ;
}
}
sparql _result = await ng . sparql _query ( session . session _id , "SELECT ?s ?a WHERE { ?s <did:ng:i> ?a }" ) ;
sparql _result = await ng . sparql _query ( session . session _id , "SELECT ?s ?a WHERE { ?s <did:ng:j> ?a }" , base ) ;
console . log ( sparql _result ) ;
console . log ( sparql _result ) ;
for ( const q of sparql _result . results . bindings ) {
for ( const q of sparql _result . results . bindings ) {
console . log ( q ) ;
console . log ( q ) ;
}
}
let quads = await ng . sparql _query ( session . session _id , "CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }" ) ;
console . log ( "******** CONSTRUCT" )
let quads = await ng . sparql _query ( session . session _id , "CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }" , base ) ;
for ( const q of quads ) {
for ( const q of quads ) {
console . log ( q . subject . toString ( ) , q . predicate . toString ( ) , q . object . toString ( ) , q . graph . toString ( ) )
console . log ( q . subject . toString ( ) , q . predicate . toString ( ) , q . object . toString ( ) , q . graph . toString ( ) )
}
}