use of nl.knaw.huygens.timbuctoo.core.dto.rdf.RdfProperty in project timbuctoo by HuygensING.
the class PropertyTripleProcessor method processAssertion.
@Override
protected void processAssertion(String vreName, String subject, String predicate, String lexicalValue, String typeUri) {
RdfProperty property = new RdfProperty(predicate, lexicalValue, typeUri);
// FIXME Add support for multiple value types
rdfImportSession.assertProperty(subject, property);
}
use of nl.knaw.huygens.timbuctoo.core.dto.rdf.RdfProperty in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method assertPropertyAlsoAddsAnAdminVersionOfTheProperty.
@Test
public void assertPropertyAlsoAddsAnAdminVersionOfTheProperty() {
TinkerPopGraphManager graphManager = newGraph().wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
Vre vre = minimalCorrectVre(instance, "vre");
instance.assertProperty(vre, "http://example.org/1", new RdfProperty("http://example.org/propName", "value", "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"));
List<Object> values = graphManager.getGraph().traversal().V().values(defaultEntityTypeName("vre") + "_" + "http://example.org/propName").toList();
assertThat(values, contains("value"));
}
use of nl.knaw.huygens.timbuctoo.core.dto.rdf.RdfProperty in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method retractRemovesThePredicateWhenNoValueTypesAreConnected.
@Test
public void retractRemovesThePredicateWhenNoValueTypesAreConnected() {
TinkerPopGraphManager graphManager = newGraph().wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
Vre vre = minimalCorrectVre(instance, "vre");
Collection defaultCollection = vre.getCollectionForTypeName(defaultEntityTypeName(vre));
RdfProperty stringProperty = new RdfProperty("http://example.org/propName", "value", "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
instance.assertProperty(vre, "http://example.org/1", stringProperty);
instance.retractProperty(vre, "http://example.org/1", stringProperty);
List<PredicateInUse> predicates = instance.getPredicatesFor(defaultCollection);
assertThat(predicates, is(empty()));
}
use of nl.knaw.huygens.timbuctoo.core.dto.rdf.RdfProperty in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method retrievePropertyReturnsThePropertyOfTheEntity.
@Test
public void retrievePropertyReturnsThePropertyOfTheEntity() {
TinkerPopGraphManager graphManager = newGraph().wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
String vreName = "vre";
Vre vre = minimalCorrectVre(instance, vreName);
String entityRdfUri = "http://example.org/1";
String predicateUri = "http://example.org/propName";
String value = "value";
instance.assertProperty(vre, entityRdfUri, new RdfProperty(predicateUri, value, "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"));
Optional<RdfReadProperty> rdfProperty = instance.retrieveProperty(vre, entityRdfUri, predicateUri);
assertThat(rdfProperty, is(present()));
assertThat(rdfProperty.get().getValue(), is(value));
}
use of nl.knaw.huygens.timbuctoo.core.dto.rdf.RdfProperty in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method retractPropertyWillBeANoopIfTheEntityDoesNotYetExist.
@Test
public void retractPropertyWillBeANoopIfTheEntityDoesNotYetExist() {
TinkerPopGraphManager graphManager = newGraph().wrap();
TinkerPopOperations instance = forGraphWrapper(graphManager);
Vre vre = instance.ensureVreExists("vre");
instance.retractProperty(vre, "http://example.org/1", new RdfProperty("http://example.org/propName", "somethingCompletelyDifferent", "http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"));
Long entitiesWithPropName = graphManager.getGraph().traversal().V().has(RDF_URI_PROP, "http://example.org/1").count().next();
assertThat(entitiesWithPropName, is(0L));
}
Aggregations