-
Notifications
You must be signed in to change notification settings - Fork 2
Bugfix 48 creator query too narrow #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
70f1d37
b2ab6d5
b12e74b
97648fe
ef308ff
2d643a1
4632e2b
aab0578
3151375
87881f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. both these new tests fail for me: +++++++++++++++++++The value of the field authorGivenName from Solr is null
The expected value of the field authorGivenName is Ian |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,11 @@ public class JsonLdSubprocessorTest extends DataONESolrJettyTestBase { | |
| private String schemaOrgTestDocDryad2Pid = "doi.org_10.5061_dryad.41sk145.jsonld"; | ||
| private Resource schemaOrgTesHakaiDeep; | ||
| private String schemaOrgTesHakaiDeepPid = "hakai-deep-schema.jsonld"; | ||
| private Resource schemaOrgTestCreatorRole; | ||
| private String schemaOrgTestCreatorRolePid = "creator-role.jsonld"; | ||
| private Resource schemaOrgTestCreatorRoleList; | ||
| private String schemaOrgTestCreatorRoleListPid = "creator-role-list.jsonld"; | ||
|
|
||
|
|
||
| /* An instance of the RDF/XML Subprocessor */ | ||
| private JsonLdSubprocessor jsonLdSubprocessor; | ||
|
|
@@ -122,6 +127,8 @@ public void setUp() throws Exception { | |
| schemaOrgTestDocDryad1 = (Resource) context.getBean("schemaOrgTestDryad1"); | ||
| schemaOrgTestDocDryad2 = (Resource) context.getBean("schemaOrgTestDryad2"); | ||
| schemaOrgTesHakaiDeep = (Resource) context.getBean("schemaOrgTesHakaiDeep"); | ||
| schemaOrgTestCreatorRole = (Resource) context.getBean("schemaOrgTestCreatorRole"); | ||
| schemaOrgTestCreatorRoleList = (Resource) context.getBean("schemaOrgTestCreatorRoleList"); | ||
|
|
||
| // instantiate the subprocessor | ||
| jsonLdSubprocessor = (JsonLdSubprocessor) context.getBean("jsonLdSubprocessor"); | ||
|
|
@@ -532,5 +539,57 @@ public void testHakaiDeep() throws Exception { | |
| String[] license = {"https://creativecommons.org/licenses/by/4.0/"}; | ||
| assertTrue(compareFieldValue(id, "licenseUrl", license)); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Test that the JsonLdSubprocessor can successfully index JSONLD documents with creator roles. | ||
| * | ||
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testCreatorRole() throws Exception { | ||
| String id = schemaOrgTestCreatorRolePid; | ||
| indexObjectToSolr(id, schemaOrgTestCreatorRole); | ||
|
|
||
| Thread.sleep(2*SLEEPTIME); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as line 579
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 3151375. |
||
| // now process the tasks | ||
| //processor.processIndexTaskQueue(); | ||
| for (int i=0; i<TIMES; i++) { | ||
| try { | ||
| Thread.sleep(SLEEP); | ||
| assertPresentInSolrIndex(id); | ||
| break; | ||
| } catch (Throwable e) { | ||
|
|
||
| } | ||
| } | ||
| assertTrue(compareFieldValue(id, "authorGivenName", "Ian")); | ||
| assertTrue(compareFieldValue(id, "authorLastName", "Nesbitt")); | ||
| } | ||
|
|
||
| /** | ||
| * Test that the JsonLdSubprocessor can successfully index JSONLD documents with creator role lists. | ||
| * | ||
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testCreatorRoleList() throws Exception { | ||
| String id = schemaOrgTestCreatorRoleListPid; | ||
| indexObjectToSolr(id, schemaOrgTestCreatorRoleList); | ||
|
|
||
| Thread.sleep(2*SLEEPTIME); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (I understand you copied this from an existing test method, but...) is this definitely needed? In the best case this test will take a minimum of 18 seconds to run (2 * SLEEPTIME + SLEEP). The whole class will take nearly 2 minutes, best case. Suggested solution is to remove
That way, flow will continue as soon as the test passes, with the potential to be a lot quicker.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (FYI, this is an approach we're gradually moving to in the metacat codebase, too)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in aab0578. |
||
| // now process the tasks | ||
| //processor.processIndexTaskQueue(); | ||
| for (int i=0; i<TIMES; i++) { | ||
| try { | ||
| Thread.sleep(SLEEP); | ||
| assertPresentInSolrIndex(id); | ||
| break; | ||
| } catch (Throwable e) { | ||
|
|
||
| } | ||
| } | ||
| assertTrue(compareFieldValue(id, "authorGivenName", "Ian")); | ||
| assertTrue(compareFieldValue(id, "authorLastName", "Nesbitt")); | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| { | ||
| "@context": "http://schema.org/", | ||
| "@type":"Dataset", | ||
| "description":"Vocab https://schema.org/, creator without @list and with @type: 'Role'. Modeled after CanWIN SO format.", | ||
| "name":"test of alternative creator field configuration", | ||
| "creator": [ | ||
| { | ||
| "@type": "Role", | ||
| "creator": { | ||
| "@type": "Person", | ||
| "Affiliation": { | ||
| "@type": "Organization", | ||
| "name": "National Center for Ecological Analaysis and Synthesis" | ||
| }, | ||
| "Email": "nesbitt@nceas.ucsb.edu", | ||
| "Identifier": { | ||
| "@type": "PropertyValue", | ||
| "propertyID": "https://registry.identifiers.org/registry/orcid", | ||
| "url": "http://orcid.org/0000-0001-5828-6070", | ||
| "value": "0000-0001-5828-6070" | ||
| }, | ||
| "Name": "Nesbitt, Ian\t" | ||
| } | ||
| }, | ||
| { | ||
| "@type": "Role", | ||
| "creator": { | ||
| "@type": "Person", | ||
| "Affiliation": { | ||
| "@type": "Organization", | ||
| "name": "National Center for Ecological Analaysis and Synthesis" | ||
| }, | ||
| "Email": "tao@nceas.ucsb.edu", | ||
| "Identifier": { | ||
| "@type": "PropertyValue", | ||
| "propertyID": "https://registry.identifiers.org/registry/orcid", | ||
| "url": "http://orcid.org/0000-0002-1209-5268", | ||
| "value": "0000-0002-1209-5268" | ||
| }, | ||
| "Name": "Tao, Jing\t" | ||
| } | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?xml version='1.0' encoding='UTF-8'?> | ||
| <ns1:systemMetadata xmlns:ns1="http://ns.dataone.org/service/types/v2.0"> | ||
| <serialVersion>1</serialVersion> | ||
| <identifier>creator-role-list.jsonld</identifier> | ||
| <formatId>science-on-schema.org/Dataset;ld+json</formatId> | ||
| <size>498</size> | ||
| <checksum algorithm="MD5"></checksum> | ||
| <submitter>dataone_integration_test_user</submitter> | ||
| <rightsHolder>dataone_integration_test_user</rightsHolder> | ||
| <accessPolicy> | ||
| <allow> | ||
| <subject>dataone_public_user</subject> | ||
| <permission>read</permission> | ||
| </allow> | ||
| <allow> | ||
| <subject>dataone_integration_test_user</subject> | ||
| <permission>write</permission> | ||
| </allow> | ||
| </accessPolicy> | ||
| <replicationPolicy replicationAllowed="true"/> | ||
| <dateUploaded>2024-08-17T12:59:47.171874</dateUploaded> | ||
| <dateSysMetadataModified>2024-08-17T12:59:47.173344</dateSysMetadataModified> | ||
| <originMemberNode>test_documents</originMemberNode> | ||
| <authoritativeMemberNode>test_documents</authoritativeMemberNode> | ||
| </ns1:systemMetadata> | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "@context": "http://schema.org/", | ||
| "@type":"Dataset", | ||
| "description":"Vocab https://schema.org/, creator without @list and with @type: 'Role'. Modeled after CanWIN SO format.", | ||
| "name":"test of alternative creator field configuration", | ||
| "creator": { | ||
| "@type": "Role", | ||
| "creator": { | ||
| "@type": "Person", | ||
| "Affiliation": { | ||
| "@type": "Organization", | ||
| "name": "National Center for Ecological Analaysis and Synthesis" | ||
| }, | ||
| "Email": "nesbitt@nceas.ucsb.edu", | ||
| "Identifier": { | ||
| "@type": "PropertyValue", | ||
| "propertyID": "https://registry.identifiers.org/registry/orcid", | ||
| "url": "http://orcid.org/0000-0001-5828-6070", | ||
| "value": "0000-0001-5828-6070" | ||
| }, | ||
| "Name": "Nesbitt, Ian\t" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?xml version='1.0' encoding='UTF-8'?> | ||
| <ns1:systemMetadata xmlns:ns1="http://ns.dataone.org/service/types/v2.0"> | ||
| <serialVersion>1</serialVersion> | ||
| <identifier>creator-role.jsonld</identifier> | ||
| <formatId>science-on-schema.org/Dataset;ld+json</formatId> | ||
| <size>498</size> | ||
| <checksum algorithm="MD5"></checksum> | ||
| <submitter>dataone_integration_test_user</submitter> | ||
| <rightsHolder>dataone_integration_test_user</rightsHolder> | ||
| <accessPolicy> | ||
| <allow> | ||
| <subject>dataone_public_user</subject> | ||
| <permission>read</permission> | ||
| </allow> | ||
| <allow> | ||
| <subject>dataone_integration_test_user</subject> | ||
| <permission>write</permission> | ||
| </allow> | ||
| </accessPolicy> | ||
| <replicationPolicy replicationAllowed="true"/> | ||
| <dateUploaded>2024-08-17T11:59:47.171874</dateUploaded> | ||
| <dateSysMetadataModified>2024-08-17T11:59:47.173344</dateSysMetadataModified> | ||
| <originMemberNode>test_documents</originMemberNode> | ||
| <authoritativeMemberNode>test_documents</authoritativeMemberNode> | ||
| </ns1:systemMetadata> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to add your
"schema_org_creator_role_name"and"schema_org_creator_list_role_name"beans to theapplication-context-json-ld.xmlfile.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 87881f0.