use of nl.knaw.huygens.timbuctoo.model.vre.Vre.KEYWORD_TYPES_PROPERTY_NAME in project timbuctoo by HuygensING.
the class LoadSaveVreTest method loadLoadsTheCollections.
@Test
public void loadLoadsTheCollections() throws JsonProcessingException {
final String entityTypeName = "person";
final String collectionName = "persons";
final HashMap<String, String> keywordTypes = new HashMap<>();
keywordTypes.put("keyword", "type");
String stringifiedKeyWordTypes = new ObjectMapper().writeValueAsString(keywordTypes);
final Vre instance = load(initGraph(g -> g.withVertex("vre", v -> v.withLabel(Vre.DATABASE_LABEL).withProperty(VRE_NAME_PROPERTY_NAME, "VreName").withProperty(KEYWORD_TYPES_PROPERTY_NAME, stringifiedKeyWordTypes)).withVertex(v -> v.withLabel(entityTypeName).withProperty(Collection.COLLECTION_NAME_PROPERTY_NAME, collectionName).withProperty(Collection.ENTITY_TYPE_NAME_PROPERTY_NAME, entityTypeName).withProperty(Collection.IS_RELATION_COLLECTION_PROPERTY_NAME, false).withIncomingRelation(HAS_COLLECTION_RELATION_NAME, "vre"))));
final Collection collectionByName = instance.getCollectionForCollectionName(collectionName).get();
assertThat(instance.getKeywordTypes().get("keyword"), equalTo("type"));
assertThat(collectionByName, instanceOf(Collection.class));
assertThat(instance.getCollectionForTypeName(entityTypeName), instanceOf(Collection.class));
assertThat(instance.getCollections().get(entityTypeName), instanceOf(Collection.class));
assertThat(instance.getEntityTypes(), contains(entityTypeName));
assertThat(instance.getImplementerOf("person").get(), equalTo(collectionByName));
assertThat(instance.getOwnType("notmytype", "person"), equalTo(entityTypeName));
}
use of nl.knaw.huygens.timbuctoo.model.vre.Vre.KEYWORD_TYPES_PROPERTY_NAME in project timbuctoo by HuygensING.
the class LoadSaveVreTest method loadLoadsAVreFromAVertex.
@Test
public void loadLoadsAVreFromAVertex() throws JsonProcessingException {
final Map<String, String> keyWordTypes = new HashMap<>();
keyWordTypes.put("keyword", "type");
String stringifiedKeyWordTypes = new ObjectMapper().writeValueAsString(keyWordTypes);
final Vre instance = load(initGraph(g -> g.withVertex(v -> v.withLabel(Vre.DATABASE_LABEL).withProperty(VRE_NAME_PROPERTY_NAME, "VreName").withProperty(KEYWORD_TYPES_PROPERTY_NAME, stringifiedKeyWordTypes))));
assertThat(instance.getVreName(), equalTo("VreName"));
assertThat(instance.getKeywordTypes().get("keyword"), equalTo("type"));
}
Aggregations