@Override public void visitManagedIndividual(ManagedIndividual individual) { this.result=IndividualReference.managed(individual.id()); } @Override
@Override public IndividualReference<ManagedIndividualId,ManagedIndividual> useName(Name<?> name) { return IndividualReference.managed(ManagedIndividualId.createId(name, this.managerId)); }
public static IndividualReference<ManagedIndividualId,ManagedIndividual> managed(Name<?> name, String templateId) { return managed(ManagedIndividualId.createId(name, templateId)); }
public static IndividualReference<ManagedIndividualId,ManagedIndividual> managed(Name<?> name, String templateId, URI indirectId) { return managed(indirectId,ManagedIndividualId.createId(name, templateId)); }
public static IndividualReference<ManagedIndividualId,ManagedIndividual> managed(URI indirectId, ManagedIndividualId parent) { return managed(ManagedIndividualId.createId(indirectId, parent)); }
@Test public void testVisitor$ManagedIndividualReference() { managed(MANAGED_INDIVIDUAL_ID). accept( new FailingVisitor() { @Override public void visitManagedIndividualReference(ManagedIndividualReference reference) { assertThat(reference.ref(),equalTo(MANAGED_INDIVIDUAL_ID)); } } ); }
@Test public void testIsPresent$ManagedIndividualReference$existingIndividual() { assertThat(managed(MANAGED_INDIVIDUAL_ID).isPresent(exampleDataSet()),equalTo(true)); }
@Test public void testVisitor$ManagedIndividualReference$indirectId$alternative() { managed(RESOURCE_NAME,MANAGER_ID,RELATIVE_PATH). accept( new FailingVisitor() { @Override public void visitManagedIndividualReference(ManagedIndividualReference reference) { assertThat(reference.ref(),equalTo(ManagedIndividualId.createId(RELATIVE_PATH,MANAGED_INDIVIDUAL_ID))); } } ); }
@Test public void testVisitor$ManagedIndividualReference$indirectId() { managed(RELATIVE_PATH,MANAGED_INDIVIDUAL_ID). accept( new FailingVisitor() { @Override public void visitManagedIndividualReference(ManagedIndividualReference reference) { assertThat(reference.ref(),equalTo(ManagedIndividualId.createId(RELATIVE_PATH,MANAGED_INDIVIDUAL_ID))); } } ); }
@Test public void testIsPresent$ManagedIndividualReference$nonExistingIndividual() { assertThat(managed(MANAGED_INDIVIDUAL_ID).isPresent(emptyDataSet()),equalTo(false)); }
@Test public void testDSL() { DataSet data= DataDSL. dataSet(). individual(id("root")). hasProperty(predicate("dataTypePropertyWithMultipleValues")). withValue("1"). withValue("2"). hasLink(predicate("objectPropertyWithMultipleReferralsAfterDatatypeProperty")). referringTo(external(EXTERNAL)). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasProperty(predicate("dataTypePropertyWithMultipleValuesAfterObjectPropertyWithMultipleReferralsAfterDatatypeProperty")). withValue("3"). withValue("4"). hasProperty(predicate("dataTypePropertyWithMultipleValuesAfterDataTypePropertyWithMultipleValuesAfterObjectPropertyWithMultipleReferralsAfterDatatypeProperty")). withValue("5"). withValue("6"). hasLink(predicate("toIndividualAfterReferring")). referringTo(external(EXTERNAL)). toIndividual(external(EXTERNAL)). hasLink(predicate("hasLink")). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasLink(predicate("toIndividualWithoutReferring")). toIndividual(external(EXTERNAL)). hasLink(predicate("hasLink")). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). build(); System.out.println(data); }
private DataSet exampleDataSet() { DataSet dataSet= DataDSL. dataSet(). individual(managed(MANAGED_INDIVIDUAL_ID)). hasProperty(HAS_TITLE). withValue("managed"). individual(relative(MANAGED_INDIVIDUAL_ID,RELATIVE_PATH)). hasProperty(HAS_TITLE). withValue("relative"). individual(newIndividual(SELF)). hasProperty(HAS_TITLE). withValue("self"). individual(newIndividual(NEW)). hasProperty(HAS_TITLE). withValue("new"). individual(anonymous(BLANK_NODE)). hasProperty(HAS_TITLE). withValue("bnode"). individual(external(EXTERNAL)). hasProperty(HAS_TITLE). withValue("external"). build(); return dataSet; }
DataDSL. dataSet(). individual(managed(MANAGED_INDIVIDUAL_ID)). hasProperty(HAS_TITLE). withValue("managed"). hasLink(HAS_LINK). referringTo(external(EXTERNAL)). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasLink(HAS_LINK). toIndividual(external(EXTERNAL)). hasLink(HAS_LINK). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasProperty(SHOULD_LINK_TO). withValue("managed").
DataDSL. dataSet(). individual(managed(MANAGED_INDIVIDUAL_ID)). hasProperty(HAS_TITLE). withValue("managed"). hasLink(HAS_LINK). referringTo(external(EXTERNAL)). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasLink(HAS_LINK). toIndividual(external(EXTERNAL)). hasLink(HAS_LINK). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasProperty(SHOULD_LINK_TO). withValue("managed").
DataDSL. dataSet(). individual(managed(MANAGED_INDIVIDUAL_ID)). hasProperty(HAS_TITLE). withValue("managed"). hasLink(HAS_LINK). referringTo(external(EXTERNAL)). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasLink(HAS_LINK). toIndividual(external(EXTERNAL)). hasLink(HAS_LINK). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasProperty(SHOULD_LINK_TO). withValue("managed").
DataDSL. dataSet(). individual(managed(MANAGED_INDIVIDUAL_ID)). hasProperty(HAS_TITLE). withValue("managed"). hasLink(HAS_LINK). referringTo(external(EXTERNAL)). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasLink(HAS_LINK). toIndividual(external(EXTERNAL)). hasLink(HAS_LINK). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasProperty(SHOULD_LINK_TO). withValue("managed").
DataDSL. dataSet(). individual(managed(MANAGED_INDIVIDUAL_ID)). hasProperty(HAS_TITLE). withValue("managed"). hasLink(HAS_LINK). referringTo(external(EXTERNAL)). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasLink(HAS_LINK). toIndividual(external(EXTERNAL)). hasLink(HAS_LINK). referringTo(managed(RESOURCE_NAME,MANAGER_ID)). hasProperty(SHOULD_LINK_TO). withValue("managed").