horizontalConstraints #259

Merged
miriam.baglioni merged 4 commits from horizontalConstraints into beta 2022-11-28 18:20:18 +01:00
4 changed files with 95 additions and 5 deletions
Showing only changes of commit 9c70c5dbd6 - Show all commits

View File

@ -26,6 +26,9 @@ public class QueryInformationSystem {
+ " return " + " return "
+ " <community> " + " <community> "
+ " { $x//CONFIGURATION/context/@id} " + " { $x//CONFIGURATION/context/@id} "
+ " <advancedConstraints>" +
"{$x//CONFIGURATION/context/param[./@name='advancedConstraints']/text() }" +
"</advancedConstraints>"
+ " <subjects> " + " <subjects> "
+ " {for $y in tokenize($subj,',') " + " {for $y in tokenize($subj,',') "
+ " return " + " return "

View File

@ -46,7 +46,9 @@ public class BulkTagJobTest {
+ " \"orcid\" : \"$['author'][*]['pid'][*][?(@['key']=='ORCID')]['value']\"," + " \"orcid\" : \"$['author'][*]['pid'][*][?(@['key']=='ORCID')]['value']\","
+ " \"contributor\" : \"$['contributor'][*]['value']\"," + " \"contributor\" : \"$['contributor'][*]['value']\","
+ " \"description\" : \"$['description'][*]['value']\", " + " \"description\" : \"$['description'][*]['value']\", "
+ " \"subject\" :\"$['subject'][*]['value']\" }"; + " \"subject\" :\"$['subject'][*]['value']\" , " +
"\"fos\" : \"$['subject'][?(@['qualifier']['classid']=='subject:fos')].value\"} ";
private static SparkSession spark; private static SparkSession spark;
@ -770,14 +772,14 @@ public class BulkTagJobTest {
org.apache.spark.sql.Dataset<Row> idExplodeCommunity = spark.sql(query); org.apache.spark.sql.Dataset<Row> idExplodeCommunity = spark.sql(query);
idExplodeCommunity.show(false); idExplodeCommunity.show(false);
Assertions.assertEquals(4, idExplodeCommunity.count()); Assertions.assertEquals(5, idExplodeCommunity.count());
Assertions Assertions
.assertEquals( .assertEquals(
3, idExplodeCommunity.filter("provenance = 'community:datasource'").count()); 3, idExplodeCommunity.filter("provenance = 'community:datasource'").count());
Assertions Assertions
.assertEquals( .assertEquals(
1, idExplodeCommunity.filter("provenance = 'community:advconstraint'").count()); 2, idExplodeCommunity.filter("provenance = 'community:advconstraint'").count());
} }
} }

View File

@ -844,6 +844,89 @@
<organizations/> <organizations/>
</community> </community>
<community id="dariah"> <community id="dariah">
<advancedConstraints>
{
"criteria": [
{
"constraint": [
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "North America"
},
{
"verb": "contains",
"field": "fos",
"value": "05"
}
]
},
{
"constraint": [
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "North America"
},
{
"verb": "contains",
"field": "fos",
"value": "06"
}
]
},
{
"constraint": [
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "Mexico"
},
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "United States"
},
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "Canada"
},
{
"verb": "contains",
"field": "fos",
"value": "05"
}
]
},
{
"constraint": [
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "Mexico"
},
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "United States"
},
{
"verb": "equals_caseinsensitive",
"field": "subject",
"value": "Canada"
},
{
"verb": "contains",
"field": "fos",
"value": "06"
}
]
}
]
}
</advancedConstraints>
<subjects/> <subjects/>
<datasources> <datasources>
<datasource> <datasource>
@ -1174,7 +1257,9 @@
</zenodocommunities> </zenodocommunities>
<organizations/> <organizations/>
</community> </community>
<community id="euromarine"> <community id="euromarine">
<subjects/> <subjects/>
<datasources/> <datasources/>
<zenodocommunities/> <zenodocommunities/>