use of nl.knaw.huygens.timbuctoo.core.dto.rdf.ImmutableCreateProperty in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method addPropertiesToCollectionsAddsPropertyDescriptionsToTheCollection.
@Test
public void addPropertiesToCollectionsAddsPropertyDescriptionsToTheCollection() {
TinkerPopGraphManager graphManager = newGraph().wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
Vre vre = instance.ensureVreExists("vre");
instance.addCollectionToVre(vre, CreateCollection.defaultCollection("vre"));
vre = instance.loadVres().getVre("vre");
Collection collection = vre.getCollectionForTypeName(defaultEntityTypeName(vre));
ImmutableCreateProperty prop1 = ImmutableCreateProperty.builder().clientName("clientName1").propertyType("string").rdfUri("http://example.org/pred1").typeUri("http://example.org/string").build();
ImmutableCreateProperty prop2 = ImmutableCreateProperty.builder().clientName("clientName2").propertyType("string").rdfUri("http://example.org/pred2").typeUri("http://example.org/string").build();
instance.addPropertiesToCollection(collection, Lists.newArrayList(prop1, prop2));
collection = instance.loadVres().getCollectionForType(defaultEntityTypeName(vre)).get();
assertThat(collection.getReadableProperties().values(), hasSize(2));
List<Vertex> properties = graphManager.getGraph().traversal().V().hasLabel("property").toList();
assertThat(properties, containsInAnyOrder(likeVertex().withProperty("clientName", "@displayName"), likeVertex().withProperty("clientName", "clientName1").withProperty("dbName", collection.getEntityTypeName() + "_" + "http://example.org/pred1").withProperty("propertyType", "string").withProperty("rdfUri", "http://example.org/pred1").withProperty("typeUri", "http://example.org/string"), likeVertex().withProperty("clientName", "clientName2").withProperty("dbName", collection.getEntityTypeName() + "_" + "http://example.org/pred2").withProperty("propertyType", "string").withProperty("rdfUri", "http://example.org/pred2").withProperty("typeUri", "http://example.org/string")));
}
Aggregations