/** * {@inheritDoc} */ @Override public IndividualPropertyHelper withLiteral(Object rawValue) { return this.pHelper.withLiteral(rawValue); }
private void populateTags(final Issue issue, final IndividualHelper individual) { for(final String tag:issue.getTags()) { individual. property(IT.ISSUE_CUSTOM_TAG). withLiteral(tag); } }
private <V> void addLiteral(final AbstractItem<V> aItem) { this.item.property(this.property).withLiteral(getValue(aItem)); }
@Test public void testWithLiteral() throws Exception { assertThat(sut.withLiteral("value"),instanceOf(IndividualPropertyHelperImpl.class)); }
@Override protected DataSet toDataSet(final Commit commit, final String commitId) { final Name<String> commitName=IdentityUtil.commitName(commitId); final DataSet dataSet=DataSets.createDataSet(commitName); final DataSetHelper helper=DataSetUtils.newHelper(dataSet); helper. managedIndividual(commitName,CommitHandler.ID). property(RDF.TYPE). withIndividual(IT.COMMIT_TYPE). property(IT.ID). withLiteral(commit.getId()). property(IT.COMMIT_ID). withLiteral(commit.getId()). property(IT.REPOSITORY). withLiteral(URI.create(commit.getRepository())). property(IT.BRANCH). withLiteral(commit.getBranch()). property(IT.HASH). withLiteral(commit.getHash()); return dataSet; }
@Override protected DataSet toDataSet(final Version version, final VersionKey key) { final Name<VersionKey> versionName=IdentityUtil.versionName(key); final DataSet dataSet=DataSets.createDataSet(versionName); final DataSetHelper helper=DataSetUtils.newHelper(dataSet); helper. managedIndividual(versionName,VersionHandler.ID). property(RDF.TYPE). withIndividual(IT.VERSION_TYPE). property(IT.ID). withLiteral(version.getId()). property(PLATFORM.NAME). withLiteral(version.getName()). property(IT.VERSION_NAME). withLiteral(version.getName()). property(IT.VERSION_ID). withLiteral(version.getId()); return dataSet; }
@Override protected DataSet toDataSet(final Contributor contributor, final String contributorId) { final Name<String> contributorName=IdentityUtil.contributorName(contributorId); final DataSet dataSet=DataSets.createDataSet(contributorName); final DataSetHelper helper=DataSetUtils.newHelper(dataSet); final IndividualPropertyHelper individual= helper. managedIndividual(contributorName,ContributorHandler.ID). property(RDF.TYPE). withIndividual(IT.CONTRIBUTOR_TYPE). property(IT.ID). withLiteral(contributor.getId()). property(IT.CONTRIBUTOR_ID). withLiteral(contributor.getId()). property(IT.CONTRIBUTOR_NAME). withLiteral(contributor.getName()); for(final String email:contributor.getEmails()) { individual. property(IT.MBOX). withLiteral(URI.create(email)); } return dataSet; }
@Override protected DataSet toDataSet(final Component component, final ComponentKey key) { final Name<ComponentKey> componentName=IdentityUtil.componentName(key); final DataSet dataSet=DataSets.createDataSet(componentName); final DataSetHelper helper=DataSetUtils.newHelper(dataSet); helper. managedIndividual(componentName,ComponentHandler.ID). property(RDF.TYPE). withIndividual(IT.COMPONENT_TYPE). property(IT.ID). withLiteral(component.getId()). property(IT.COMPONENT_ID). withLiteral(component.getId()). property(DCTERMS.TITLE). withLiteral(component.getName()). property(IT.COMPONENT_TITLE). withLiteral(component.getName()); return dataSet; }
withIndividual(CI_BUILD_TYPE). property(DC_TERMS_IDENTIFIER). withLiteral(build.buildId()). property(DC_TERMS_CREATED). withLiteral(build.createdOn()). property(DC_TERMS_TITLE). withLiteral(build.title()). property(DC_TERMS_DESCRIPTION). withLiteral(build.description()). property(SCM_LOCATION). withLiteral(build.codebase().location()). property(CI_BRANCH_SPECIFIER). withLiteral(build.codebase().branchName()). property(CI_LOCATION). withLiteral(build.location());
@Override protected DataSet toDataSet(final Project project, final String repositoryId) { final Name<String> projectName=IdentityUtil.projectName(repositoryId); final DataSet dataSet=DataSets.createDataSet(projectName); final DataSetHelper helper=DataSetUtils.newHelper(dataSet); final IndividualPropertyHelper individual = helper. managedIndividual(projectName,ProjectHandler.ID). property(RDF.TYPE). withIndividual(IT.PROJECT_TYPE). property(IT.ID). withLiteral(project.getId()). property(IT.PROJECT_ID). withLiteral(project.getId()). property(DCTERMS.TITLE). withLiteral(project.getName()). property(IT.PROJECT_TITLE). withLiteral(project.getName()); for(final String issueId:project.getTopIssues()) { final Name<IssueKey> issueName= IdentityUtil. issueName( new IssueKey(project.getId(),issueId)); individual. property(IT.HAS_PROJECT_TOP_ISSUE). withIndividual(issueName,IssueHandler.ID); } return dataSet; }
@Test public void testIndividualHelperCreation() { DataSet data=exampleDataSet(); Individual<?,?> individual = data.individualOfId(BLANK_NODE); DataSetUtils.newHelper(individual).property(RDFS.LABEL).withLiteral("My label"); assertThat(individual.property(RDFS.LABEL.as(URI.class)).hasLiteralValue(Literals.of("My label")),equalTo(true)); }
private void populateChangeLogEntry(final Issue issue, final Entry entryData, final Name<String> entryName, final DataSetHelper helper, final IndividualHelper changeLog) { final IndividualHelper entry = helper. localIndividual(entryName); changeLog. property(IT.HAS_CHANGE_LOG_ENTRY). withIndividual(entryName); entry. property(RDF.TYPE). withIndividual(IT.CHANGE_LOG_ENTRY_TYPE). property(IT.ENTRY_TIME_STAMP). withLiteral(entryData.getTimeStamp()); /** * TODO: Should fail if no author is defined */ new ContributorLinker(entry). link(IT.TRIGGERED_BY,entryData.getAuthor()); int itemCount=0; for(final Item item:entryData.getItems()) { final Name<String> itemName=NamingScheme.getDefault().name(entryName.id(),"item",Integer.toString(itemCount++)); populateChangeLogItem(issue,item, itemName, helper, changeLog, entry); } }
withIndividual(VOCABULARY_TYPE). property(SOURCE). withLiteral(URI.create(CI_V1_TTL)). property(DC_TERMS_SOURCE). withLiteral(URI.create(CI_V1_TTL)). property(IMPLEMENTS). withIndividual(CI_DOMAIN_TYPE);
@Override public DataSet get(final ResourceSnapshot resource) { final DataSet dataSet=DataSets.createDataSet(resource.name()); final DataSetHelper helper=DataSetUtils.newHelper(dataSet); helper. managedIndividual(resource.name(), ID). property(RDF.TYPE). withIndividual(DCTYPE.SERVICE_TYPE). withIndividual(PLATFORM.MICRO_SERVICE_TYPE). withIndividual(PLATFORM.LINKED_DATA_MICRO_SERVICE_TYPE). withIndividual(PLATFORM.HARVESTER_TYPE). withIndividual(IT.HARVESTER_TYPE). property(PLATFORM.HARVESTER_VOCABULARY). withIndividual(resource.name(),HarvesterHandler.ID,VOCABULARY_PATH); helper. relativeIndividual(resource.name(),HarvesterHandler.ID,VOCABULARY_PATH). property(RDF.TYPE). withIndividual(IT.VOCABULARY_TYPE). withIndividual(PLATFORM.VOCABULARY_TYPE). property(PLATFORM.SOURCE). withLiteral(IT.sourceCode()). property(DCTERMS.SOURCE). withLiteral(IT.sourceCode()). property(PLATFORM.IMPLEMENTS). withIndividual(IT.DOMAIN_TYPE); return dataSet; }
managedIndividual(name("unknown"),"managerId"). property(RDFS.LABEL). withLiteral("label"). property("http://www.example.org/vocab#targetManagedResource"). withIndividual(name("missing"),"missingManagerId"). localIndividual(name("unknown")). property(RDFS.LABEL). withLiteral("label"). property("http://www.example.org/vocab#targetManagedResource"). withIndividual(name("unknown"),"managerId");
withIndividual(IT.ISSUE_TYPE). property(IT.ID). withLiteral(issue.getId()). property(IT.ISSUE_ID). withLiteral(issue.getId()). property(DCTERMS.TITLE). withLiteral(issue.getName()).
managedIndividual(RESOURCE_NAME, MANAGER_ID). property(HAS_TITLE). withLiteral("managed"). withLiteral("custom"). property(HAS_LINK). relativeIndividual(RESOURCE_NAME, MANAGER_ID,RELATIVE_PATH). property(HAS_TITLE). withLiteral("relative"). withLiteral("custom"). property(HAS_LINK). localIndividual(BLANK_NODE). property(HAS_TITLE). withLiteral("bnode"). withLiteral("custom"). property(HAS_LINK). externalIndividual(SELF). property(HAS_TITLE). withLiteral("self"). withLiteral("custom"). property(HAS_LINK). externalIndividual(NEW). property(HAS_TITLE). withLiteral("new"). withLiteral("custom"). property(HAS_LINK).
withIndividual(CI_EXECUTION). property(DC_TERMS_IDENTIFIER). withLiteral(execution.executionId()). property(DC_TERMS_CREATED). withLiteral(execution.createdOn()). withIndividual(CI_FINISHED_EXECUTION). property(CI_FINISHED). withLiteral(execution.result().finishedOn()); } else { executionHelper. withIndividual(resultMapping.resultType()). property(CI_LOCATION). withLiteral(execution.executionId()). property(STATE). withIndividual(resultMapping.state()).