Search in sources :

Example 6 with ReadableProperty

use of nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty in project timbuctoo by HuygensING.

the class TinkerPopPropertyConverterTest method fromThrowsAnIoExceptionIfThePropertyCannotBeConverted.

@Test(expected = IOException.class)
public void fromThrowsAnIoExceptionIfThePropertyCannotBeConverted() throws UnknownPropertyException, IOException {
    Collection collection = mock(Collection.class);
    ReadableProperty readableProperty = mock(ReadableProperty.class);
    when(readableProperty.getUniqueTypeId()).thenReturn("string");
    when(collection.getProperty(PROPERTY_NAME)).thenReturn(Optional.of(readableProperty));
    TinkerPopPropertyConverter instance = new TinkerPopPropertyConverter(collection);
    instance.from(PROPERTY_NAME, new Object());
}
Also used : ReadableProperty(nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty) TinkerPopPropertyConverter(nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) Test(org.junit.Test)

Example 7 with ReadableProperty

use of nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty in project timbuctoo by HuygensING.

the class TinkerPopPropertyConverterTest method fromCreatesAStringPropertyWhenUsesTheUniqueTypeIdOfThePropertyToDetermineTheTimPropertyType.

@Test
public void fromCreatesAStringPropertyWhenUsesTheUniqueTypeIdOfThePropertyToDetermineTheTimPropertyType() throws UnknownPropertyException, IOException {
    Collection collection = mock(Collection.class);
    ReadableProperty readableProperty = mock(ReadableProperty.class);
    when(readableProperty.getUniqueTypeId()).thenReturn("string");
    when(collection.getProperty(PROPERTY_NAME)).thenReturn(Optional.of(readableProperty));
    TinkerPopPropertyConverter instance = new TinkerPopPropertyConverter(collection);
    TimProperty property = instance.from(PROPERTY_NAME, STRING_VALUE);
    assertThat(property, is(instanceOf(StringProperty.class)));
}
Also used : ReadableProperty(nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty) TinkerPopPropertyConverter(nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter) TimProperty(nl.knaw.huygens.timbuctoo.core.dto.property.TimProperty) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) Test(org.junit.Test)

Example 8 with ReadableProperty

use of nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty in project timbuctoo by HuygensING.

the class PrepareForBiaImportMigration method addConceptsCollectionToAdminVre.

private void addConceptsCollectionToAdminVre(Graph graph) {
    final Vre adminVre = mappings.getVre("Admin");
    final LinkedHashMap<String, ReadableProperty> conceptProperties = Maps.newLinkedHashMap();
    conceptProperties.put("label", localProperty("label"));
    final Collection conceptsCollection = new Collection("concept", "concept", localProperty("label"), conceptProperties, "concepts", mappings.getVre("Admin"), "concepts", false, false, null);
    adminVre.addCollection(conceptsCollection);
    adminVre.save(graph);
}
Also used : ReadableProperty(nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection)

Aggregations

ReadableProperty (nl.knaw.huygens.timbuctoo.model.properties.ReadableProperty)8 Collection (nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection)6 Test (org.junit.Test)5 TinkerPopPropertyConverter (nl.knaw.huygens.timbuctoo.database.tinkerpop.conversion.TinkerPopPropertyConverter)4 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)2 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 TimProperty (nl.knaw.huygens.timbuctoo.core.dto.property.TimProperty)1 JsonPropertyConverter (nl.knaw.huygens.timbuctoo.crud.conversion.JsonPropertyConverter)1 Vre (nl.knaw.huygens.timbuctoo.model.vre.Vre)1