feat/orm
Laurin Weger 2 weeks ago
parent c71df72e92
commit 6ed1359887
No known key found for this signature in database
GPG Key ID: 9B372BB0B792770F
  1. 17
      nextgraph/src/tests/orm.rs

@ -10,7 +10,8 @@
use crate::local_broker::{doc_create, doc_sparql_construct, doc_sparql_update};
use crate::tests::create_or_open_wallet::create_or_open_wallet;
use ng_net::orm::{
BasicType, OrmSchemaDataType, OrmSchemaLiteralType, OrmSchemaPredicate, OrmSchemaShape, OrmShapeType
BasicType, OrmSchemaDataType, OrmSchemaLiteralType, OrmSchemaPredicate, OrmSchemaShape,
OrmShapeType,
};
use ng_repo::log_info;
use ng_verifier::orm::shape_type_to_sparql;
@ -109,9 +110,9 @@ INSERT DATA {
Arc::new(OrmSchemaPredicate {
dataTypes: vec![OrmSchemaDataType {
valType: OrmSchemaLiteralType::literal,
literals: Some(vec![
BasicType::Str("http://example.org/TestObject".to_string()),
]),
literals: Some(vec![BasicType::Str(
"http://example.org/TestObject".to_string(),
)]),
shape: None,
}],
iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type".to_string(),
@ -287,7 +288,7 @@ INSERT DATA {
};
// Generate and execute the CONSTRUCT query
let query = shape_type_to_sparql(&shape_type, Some(1)).unwrap();
let query = shape_type_to_sparql(&shape_type.schema, &shape_type.shape, None).unwrap();
let triples = doc_sparql_construct(session_id, query, Some(doc_nuri.clone()))
.await
@ -390,7 +391,7 @@ INSERT DATA {
};
// Generate and run query
let query = shape_type_to_sparql(&shape_type, Some(1)).unwrap();
let query = shape_type_to_sparql(&shape_type.schema, &shape_type.shape, None).unwrap();
let triples = doc_sparql_construct(session_id, query, Some(doc_nuri.clone()))
.await
.unwrap();
@ -453,7 +454,7 @@ INSERT DATA {
};
// Generate and run query
let query = shape_type_to_sparql(&shape_type, Some(1)).unwrap();
let query = shape_type_to_sparql(&shape_type.schema, &shape_type.shape, None).unwrap();
let triples = doc_sparql_construct(session_id, query, Some(doc_nuri.clone()))
.await
.unwrap();
@ -528,7 +529,7 @@ INSERT DATA {
};
// Generate and run query. This must not infinite loop.
let query = shape_type_to_sparql(&shape_type, Some(1)).unwrap();
let query = shape_type_to_sparql(&shape_type.schema, &shape_type.shape, None).unwrap();
log_info!("cyclic query result:\n{}", query);
let triples = doc_sparql_construct(session_id, query, Some(doc_nuri.clone()))
.await

Loading…
Cancel
Save