use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class DeleteQueryTest method whenDeletingAResource_TheResourceAndImplicitRelationsAreDeleted.
@Test
public void whenDeletingAResource_TheResourceAndImplicitRelationsAreDeleted() {
ConceptId id = qb.match(x.has("title", "Godfather"), var("a").rel(x).rel(y).isa(Schema.ImplicitType.HAS.getLabel("tmdb-vote-count").getValue())).get("a").findFirst().get().getId();
assertExists(qb, var().has("title", "Godfather"));
assertExists(qb, var().id(id));
assertExists(qb, var().val(1000L).isa("tmdb-vote-count"));
qb.match(x.val(1000L).isa("tmdb-vote-count")).delete(x).execute();
assertExists(qb, var().has("title", "Godfather"));
assertNotExists(qb, var().id(id));
assertNotExists(qb, var().val(1000L).isa("tmdb-vote-count"));
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class InsertQueryTest method testInsertResourceOnExistingResourceIdWithType.
@Test
public void testInsertResourceOnExistingResourceIdWithType() {
ConceptId apocalypseNow = qb.match(var("x").val("Apocalypse Now")).get("x").findAny().get().getId();
assertNotExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
qb.insert(var().id(apocalypseNow).isa("title").has("title", "Apocalypse Maybe Tomorrow")).execute();
assertExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class InsertQueryTest method testInsertResourceOnExistingIdWithType.
@Test
public void testInsertResourceOnExistingIdWithType() {
ConceptId apocalypseNow = qb.match(var("x").has("title", "Apocalypse Now")).get("x").findAny().get().getId();
assertNotExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
qb.insert(var().id(apocalypseNow).isa("movie").has("title", "Apocalypse Maybe Tomorrow")).execute();
assertExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class InsertQueryTest method testInsertResourceOnExistingResourceId.
@Test
public void testInsertResourceOnExistingResourceId() {
ConceptId apocalypseNow = qb.match(var("x").val("Apocalypse Now")).get("x").findAny().get().getId();
assertNotExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
qb.insert(var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow")).execute();
assertExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
}
use of ai.grakn.concept.ConceptId in project grakn by graknlabs.
the class InsertQueryTest method testInsertResourceOnExistingId.
@Test
public void testInsertResourceOnExistingId() {
ConceptId apocalypseNow = qb.match(var("x").has("title", "Apocalypse Now")).get("x").findAny().get().getId();
assertNotExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
qb.insert(var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow")).execute();
assertExists(qb, var().id(apocalypseNow).has("title", "Apocalypse Maybe Tomorrow"));
}
Aggregations