RDF resource identifier is without overlay id

master
Niko PLP 4 months ago
parent cc89bb1808
commit e453c8998f
  1. 4
      ng-app/src/apps/ContainerView.svelte
  2. 6
      ng-app/src/lib/panes/Files.svelte
  3. 6
      ng-app/src/lib/panes/History.svelte
  4. 12
      ng-app/src/store.ts
  5. 5
      ng-app/src/tab.ts
  6. 8
      ng-net/src/app_protocol.rs
  7. 1
      ng-net/src/broker.rs
  8. 1
      ng-repo/src/event.rs
  9. 6
      ng-sdk-js/app-node/index.js
  10. 4
      ng-sdk-js/src/lib.rs
  11. 3
      ng-verifier/src/request_processor.rs

@ -28,8 +28,8 @@
function contained(graph) {
let ret = [];
for (const g of graph) {
if (g.substring(104,137) === "http://www.w3.org/ns/ldp#contains") {
let nuri = g.substring(140,240);
if (g.substring(57,90) === "http://www.w3.org/ns/ldp#contains") {
let nuri = g.substring(93,193);
let hash = nuri.substring(9,16);
ret.push({nuri,hash});
}

@ -31,7 +31,7 @@
let upload_progress: null | { total: number; current: number; error?: any } = null;
let commits = $active_session && branch_subscribe($cur_tab.branch.nuri, false);
let commits = $active_session && branch_subscribe($cur_tab.branch.nuri+":"+$cur_tab.store.overlay, false);
let fileinput;
let file_urls = {};
@ -46,7 +46,7 @@
const download = async (file) => {
if (is_tauri) {
await ng.file_save_to_downloads($active_session.session_id, file.reference, file.name, "did:ng:"+$cur_tab.branch.nuri);
await ng.file_save_to_downloads($active_session.session_id, file.reference, file.name, "did:ng:"+$cur_tab.branch.nuri+":"+$cur_tab.store.overlay);
} else {
file_urls[file.nuri].url = await get_blob(file, false);
//console.log(file.name);
@ -144,7 +144,7 @@
let start_request_payload = {
RandomAccessFilePut: image.type,
};
let nuri = "did:ng:"+$cur_tab.branch.nuri;
let nuri = "did:ng:"+$cur_tab.branch.nuri+":"+$cur_tab.store.overlay;
let start_res = await ng.app_request_with_nuri_command(nuri, "FilePut", $active_session.session_id, start_request_payload);
let upload_id = start_res.V0.FileUploading;

@ -55,7 +55,7 @@
commit: { message: { displayAuthor: false, displayHash: false } },
}),
});
let res = await ng.branch_history($active_session.session_id, "did:ng:"+$cur_tab.branch.nuri);
let res = await ng.branch_history($active_session.session_id, "did:ng:"+$cur_tab.branch.nuri+":"+$cur_tab.store.overlay);
// for (const h of res.history) {
// console.log(h[0], h[1]);
// }
@ -75,7 +75,7 @@
onMessageClick:()=>openCommit(h[0])
};}));
let branch = branch_subscribe($cur_tab.branch.nuri,false);
let branch = branch_subscribe($cur_tab.branch.nuri+":"+$cur_tab.store.overlay,false);
unsub();
unsub = branch.subscribe((b) => {
//console.log("subscription callbak",b.history.commits);
@ -100,7 +100,7 @@
});
onDestroy( ()=>{
let branch = branch_subscribe($cur_tab.branch.nuri,false);
let branch = branch_subscribe($cur_tab.branch.nuri+":"+$cur_tab.store.overlay,false);
get(branch).history.stop();
unsub();
});

@ -420,7 +420,7 @@ export const live_discrete_update = async (update, crdt, heads) => {
});
throw new Error("no session");
}
let nuri = "did:ng:"+get(cur_tab).branch.nuri;
let nuri = "did:ng:"+get(cur_tab).doc.nuri+":"+get(cur_tab).store.overlay;
await ng.discrete_update(session.session_id, update, heads, crdt, nuri);
}
@ -433,9 +433,9 @@ export const sparql_query = async function(sparql:string, union:boolean) {
});
throw new Error("no session");
}
let base = "did:ng:"+get(cur_tab).branch.nuri;
console.log(base)
let nuri = union ? undefined : base;
let base = "did:ng:"+get(cur_tab).doc.nuri;
//console.log("BASE",base)
let nuri = union ? undefined : (base+":"+get(cur_tab).store.overlay);
return await ng.sparql_query(session.session_id, sparql, base, nuri);
}
@ -448,7 +448,7 @@ export const sparql_update = async function(sparql:string) {
});
throw new Error("no session");
}
let nuri = "did:ng:"+get(cur_tab).branch.nuri;
let nuri = "did:ng:"+get(cur_tab).doc.nuri+":"+get(cur_tab).store.overlay;
await ng.sparql_update(session.session_id, sparql, nuri);
}
@ -723,7 +723,7 @@ export async function get_blob(ref: { nuri: string; reference: { key: any; id: a
try {
let final_blob;
let content_type;
let branch_nuri = "did:ng:"+get(cur_tab).branch.nuri;
let branch_nuri = "did:ng:"+get(cur_tab).doc.nuri+":"+get(cur_tab).store.overlay;
let cancel = await ng.file_get(get(active_session).session_id, ref.reference, branch_nuri, async (blob) => {
//console.log("GOT APP RESPONSE", blob);
if (blob.V0.FileMeta) {

@ -173,7 +173,8 @@ export const open_branch = (nuri: string, in_tab: boolean) => {
if (!old[nuri]) {
//console.log("creating tab for ",nuri)
old[nuri] = JSON.parse(JSON.stringify(old[""]));
old[nuri].branch.nuri = nuri;
old[nuri].branch.nuri = nuri.substring(0,nuri.length-47); // we remove the ":v:[char;44]" part
old[nuri].store.overlay = nuri.substring(nuri.length-47); // and put it in store.overlay
}
return old;
});
@ -245,7 +246,7 @@ export const all_tabs = writable({
can_edit: false,
},
branch: {
nuri: "", // :o:v or :o:v:b
nuri: "", // :o or :o:b
readcap: "", // "r:"
comment_branch: "", // nuri
class: "",

@ -259,6 +259,14 @@ impl NuriV0 {
Ok(format!("{DID_PREFIX}:o:{repo_id}:u:{sko}"))
}
pub fn repo(&self) -> String {
Self::repo_id(self.target.repo_id())
}
pub fn repo_id(repo_id: &RepoId) -> String {
format!("{DID_PREFIX}:o:{}", repo_id)
}
pub fn overlay_id(overlay_id: &OverlayId) -> String {
format!("{DID_PREFIX}:v:{overlay_id}")
}

@ -29,7 +29,6 @@ use ng_repo::errors::*;
use ng_repo::log::*;
use ng_repo::types::*;
use crate::actor::EActor;
use crate::actor::SoS;
use crate::connection::*;
use crate::server_broker::IServerBroker;

@ -16,7 +16,6 @@ use chacha20::ChaCha20;
use zeroize::Zeroize;
use crate::errors::*;
use crate::log::*;
use crate::repo::{BranchInfo, Repo};
use crate::store::Store;
use crate::types::*;

@ -65,10 +65,10 @@ ng.init_headless(config).then( async() => {
//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> . }");
//await ng.sparql_update(session.session_id, "INSERT DATA { <> <a:self> <a:self> . }",base);
await ng.sparql_update(session.session_id, "INSERT DATA { <> <a:selftest> <a:selftest> . }",base);
await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:TEST4> <did:ng:j> _:_ . _:_ <did:ng:m> <did:ng:n> . }");
await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:TEST5> <did:ng:j> [ <did:ng:m> <did:ng:n> ]. }");
//await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:TEST4> <did:ng:j> _:_ . _:_ <did:ng:m> <did:ng:n> . }");
//await ng.sparql_update(session.session_id, "INSERT DATA { <did:ng:TEST5> <did:ng:j> [ <did:ng:m> <did:ng:n> ]. }");
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);

@ -375,7 +375,9 @@ pub async fn sparql_update(
let (nuri, base) = if nuri.is_string() {
let n = nuri.as_string().unwrap();
(NuriV0::new_from(&n).map_err(|e| e.to_string())?, Some(n))
let nuri = NuriV0::new_from(&n).map_err(|e| e.to_string())?;
let b = nuri.repo();
(nuri, Some(b))
} else {
(NuriV0::new_private_store_target(), None)
};

@ -269,8 +269,7 @@ impl Verifier {
let overlay_id = doc_create.store.outer_overlay();
let nuri = NuriV0::repo_graph_name(&repo_id, &overlay_id);
let store_nuri = NuriV0::from_store_repo(&doc_create.store);
let store_nuri_string =
NuriV0::repo_graph_name(doc_create.store.repo_id(), &overlay_id);
let store_nuri_string = NuriV0::repo_id(doc_create.store.repo_id());
let query = format!("INSERT DATA {{ <{store_nuri_string}> <http://www.w3.org/ns/ldp#contains> <{nuri}>. }}");
let ret = self

Loading…
Cancel
Save