Project

General

Profile

« Previous | Next » 

Revision 8757

first pass at direct EML->semantic index method. Still produces an RDF model, but does not persist it in Metacat, only in the triplestore. Allows us to re-run without adding stale RDF to the MN store.

View differences:

DatapackageSummarizerTest.java
78 78
	public static Test suite() {
79 79
		TestSuite suite = new TestSuite();
80 80
//		suite.addTest(new DatapackageSummarizerTest("testGenerateAnnotations"));
81
		suite.addTest(new DatapackageSummarizerTest("testGenerateAnnotation"));
81
//		suite.addTest(new DatapackageSummarizerTest("testGenerateAnnotation"));
82
		suite.addTest(new DatapackageSummarizerTest("testStandaloneAnnotation"));
82 83
//		suite.addTest(new DatapackageSummarizerTest("testGenerateRandomAnnotation"));
83 84
		return suite;
84 85
	}
85 86
	
87
	public void testStandaloneAnnotation() throws Exception {
88
		// insert the test document to sem-index
89
		Identifier metadataPid = new Identifier();
90
		metadataPid.setValue("testAnnotation.eml." + System.currentTimeMillis());
91
		Session session = getTestSession();
92
		try {
93
			InputStream object = new ByteArrayInputStream(this.getTestDocFromFile(ANNOTATION_TEST_DOC).getBytes("UTF-8"));
94
			SystemMetadata sysmeta = createSystemMetadata(metadataPid, session.getSubject(), object);
95
			ObjectFormatIdentifier formatId = new ObjectFormatIdentifier();
96
			formatId.setValue("eml://ecoinformatics.org/eml-2.0.0");
97
			sysmeta.setFormatId(formatId);
98
			Identifier pid = MNodeService.getInstance(request).create(session, metadataPid, object, sysmeta);
99
			assertEquals(metadataPid.getValue(), pid.getValue());
100
		} catch (Exception e) {
101
			e.printStackTrace();
102
			fail("Could not add metadata test file: " + e.getMessage());
103
		}
104
		
105
		// index it
106
		DatapackageSummarizer ds = new DatapackageSummarizer();
107
		ds.indexEphemeralAnnotation(metadataPid);
108
		
109
		// check it
110
		
111
	}
112
	
86 113
	/**
87 114
	 * Generate a single annotation based exclusively on the metadata
88 115
	 * @throws Exception

Also available in: Unified diff