本文整理匯總了Java中org.apache.taverna.robundle.manifest.PathAnnotation類的典型用法代碼示例。如果您正苦於以下問題:Java PathAnnotation類的具體用法?Java PathAnnotation怎麽用?Java PathAnnotation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PathAnnotation類屬於org.apache.taverna.robundle.manifest包,在下文中一共展示了PathAnnotation類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: bundleSubjects
import org.apache.taverna.robundle.manifest.PathAnnotation; //導入依賴的package包/類
@SuppressWarnings("deprecation")
private Collection<URI> bundleSubjects() throws IOException {
Set<URI> subjects = new HashSet<>();
subjects.add(bundle.getRoot().toUri());
for (PathMetadata pathMetadata : manifest.getAggregates()) {
subjects.add(pathMetadata.getUri());
if (pathMetadata.getFile() != null)
subjects.add(pathMetadata.getFile().toUri());
if (pathMetadata.getFolder() != null)
subjects.add(pathMetadata.getFolder().toUri());
// subjects.add(pathMetadata.getProxy());
}
for (PathAnnotation a : manifest.getAnnotations())
subjects.add(a.getUri());
subjects.remove(null);
return subjects;
}
示例2: addAggregation
import org.apache.taverna.robundle.manifest.PathAnnotation; //導入依賴的package包/類
/**
* Add an aggregation to the Research Object Bundle
* @param roBundle The bundle to add to
* @param fileName The file name of the aggregation
* @param manifestAnnotations The list of manifest aggregations
* @param content The identifier for the resource containing the
* body of the annotation
* @throws IOException Errors accessing the bundle
*/
private void addAggregation(Bundle roBundle,
List<PathAnnotation> manifestAnnotations,
String fileName,
String content) throws IOException {
Path annotations = Bundles.getAnnotations(roBundle);
Path packedPath = annotations.resolve(fileName);
Bundles.setStringValue(packedPath, content);
PathAnnotation packedFile = new PathAnnotation();
packedFile.setContent(packedPath);
packedFile.setAbout(roBundle.getManifest().getId());
packedFile.generateAnnotationId();
manifestAnnotations.add(packedFile);
}
示例3: generateAndSaveROBundle
import org.apache.taverna.robundle.manifest.PathAnnotation; //導入依賴的package包/類
/**
* Generate a Research Object bundle from lobstr and check it
*/
@Test
public void generateAndSaveROBundle() throws Exception {
// RO details
GitDetails lobSTRdraft3RODetails = new GitDetails("https://github.com/common-workflow-language/workflows.git",
"933bf2a1a1cce32d88f88f136275535da9df0954", "lobstr-draft3/");
// Create new RO bundle
Bundle bundle = roBundleService.createBundle(lobSTRdraft3, lobSTRdraft3RODetails);
Path bundleRoot = bundle.getRoot().resolve("workflow");
// Check bundle exists
assertNotNull(bundle);
// Check basic manifest metadata
Manifest manifest = bundle.getManifest();
assertEquals("CWL Viewer", manifest.getCreatedBy().getName());
assertEquals("https://view.commonwl.org", manifest.getCreatedBy().getUri().toString());
assertEquals("Mark Robinson", manifest.getAuthoredBy().get(0).getName());
assertEquals(new URI("https://w3id.org/cwl/view/git/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/lobSTR/lobSTR-workflow.cwl"),
manifest.getId());
assertEquals(new URI("https://w3id.org/cwl/view/git/933bf2a1a1cce32d88f88f136275535da9df0954/workflows/lobSTR/lobSTR-workflow.cwl?format=ro"),
manifest.getRetrievedFrom());
// Check cwl aggregation information
assertEquals(14, manifest.getAggregates().size());
PathMetadata cwlAggregate = manifest.getAggregation(
bundleRoot.resolve("lobSTR-workflow.cwl"));
// NOTE: This permalink is based on local folder structure, here in tests
// it is slightly different but normally would not be
assertEquals("https://w3id.org/cwl/view/git/933bf2a1a1cce32d88f88f136275535da9df0954/lobstr-draft3/lobSTR-workflow.cwl?format=raw",
cwlAggregate.getRetrievedFrom().toString());
assertEquals("Mark Robinson", cwlAggregate.getAuthoredBy().get(0).getName());
assertEquals("mailto:[email protected]", cwlAggregate.getAuthoredBy().get(0).getUri().toString());
assertNull(cwlAggregate.getAuthoredBy().get(0).getOrcid());
assertEquals("text/x-yaml", cwlAggregate.getMediatype());
assertEquals("https://w3id.org/cwl/draft-3", cwlAggregate.getConformsTo().toString());
// Check visualisations exist as aggregates
PathMetadata pngAggregate = manifest.getAggregation(bundleRoot.resolve("visualisation.png"));
assertEquals("image/png", pngAggregate.getMediatype());
PathMetadata svgAggregate = manifest.getAggregation(bundleRoot.resolve("visualisation.svg"));
assertEquals("image/svg+xml", svgAggregate.getMediatype());
// Check RDF and packed workflows exist as annotations
List<PathAnnotation> annotations = manifest.getAnnotations();
assertEquals(2, annotations.size());
assertEquals(new URI("annotations/merged.cwl"), annotations.get(0).getContent());
assertEquals(new URI("annotations/workflow.ttl"), annotations.get(1).getContent());
// Check git2prov link is in the history
List<Path> history = manifest.getHistory();
assertEquals(1, history.size());
assertEquals("http:/git2prov.org/git2prov?giturl=https:/github.com/common-workflow-language/workflows.git&serialization=PROV-JSON",
history.get(0).toString());
// Save and check it exists in the temporary folder
roBundleService.saveToFile(bundle);
File[] fileList = roBundleFolder.getRoot().listFiles();
assertTrue(fileList.length == 1);
for (File ro : fileList) {
assertTrue(ro.getName().endsWith(".zip"));
Bundle savedBundle = Bundles.openBundle(ro.toPath());
assertNotNull(savedBundle);
}
}