Skip to content

Commit 68a31ed

Browse files
authored
Dhf5.1.0 to dhf5.7.2 (#16)
Feature branch was originally started to upgrade the Data Hub Foundation version from 5.1.0 to 5.7.2 but when DH moved 5.8 during the changes, I removed all the DH components entirely. They are brought into the project with hubInit instead which is much more standard operating procedure and much cleaner. * Add codepoint to match with created Element Range Index definitions. * DH version bump to 5.7.2 * DH 5.1.0 to 5.7.2 * Gradle version 5.2.1 -> 6.9.1 * Remove DeployHubOtherServersCommand unit test refs * mlDHFVersion no longer has any impact starting in version 5.3.0. You may safely remove this from your properties file. * runAllPPM -> examples:person-position-matching:runAll * Add range-element-index instructions. * Comment out unit test framework. * Remove instruction re: data zip file which longer exists nor is necessary * runAll -> runAndDeployAll * Close bracket for cleanliness * Formatting, HADOOP_HOME, and remove Windows drug load instruction. * Fix -input_file_path for drugZipLoad. Clarify instructions. * Update loadPubMedCentral instructions to include FTP site and path location. * Adjust -input_file_path of pubMedInputFlowFTP. loadStudy -> LoadStudy * loadDrug -> LoadDrug flow-name change. * Internal grove-core-react-redux-containers replaced with public github accessible version. * Deleted all of the DH hubInit generated files. * Update versions, repos, and remove DH compile. * Changed the instructions to initialize Data Hub with hubInit. Formatting. * Remove deprecated jcenter. * Configure example specific indexes using mlConfigPaths instead of modifying final-database.json directly.
1 parent 54fa324 commit 68a31ed

File tree

59 files changed

+290
-1415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+290
-1415
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ There are two main steps to use this application:
1111
## 1. Install Research Hub
1212
#### Prerequites
1313
1. MarkLogic 9.0-11 or 10.0-3
14-
2. DataHub 5.1.0 (included)
1514
3. Java 8+ (used for running QuickStart and gradle-wrapper)
1615
4. Node 10 or 12
1716
5. Optionally Docker Desktop if you want/need to run MarkLogic inside a container
@@ -22,12 +21,18 @@ It is recommended to use the default ports, DB names, and App Server names defin
2221

2322
#### 1.2 Deploy DHF
2423

25-
./gradlew mlDeploy
24+
First, generate Data Hub source files:
25+
26+
`./gradlew hubInit`
27+
28+
Second, deploy the database components (including Data Hub) to MarkLogic:
29+
30+
`./gradlew mlDeploy`
2631

2732
### 1.3 Install UI
2833

29-
cd ui
30-
npm install
34+
`cd ui`
35+
`npm install`
3136

3237
## 2. Install One of the Included Examples
3338
Two examples are included in this code base. By copying these example files into the main code area, and modifying some core files, you will be installing a fully-functional Research Hub. These are included to provide sample code and patterns for building your own research hubs.
@@ -42,37 +47,39 @@ To install one of the example domains, follow the README.md file in that example
4247
You can create your own entity by running a gradle command to scaffold the files you need.
4348

4449
run
45-
./gradlew createEntity -PentityName=YourEntityName
50+
`./gradlew createEntity -PentityName=YourEntityName`
4651

4752
The task will create the necessary files and print out their locations for you to go edit.
4853

4954
### Deleting a scaffolded entity
5055
If for some reason you need to delete an entity that you scaffolded, simply run this command.
5156
run
5257

53-
./gradlew deleteEntity -PentityName=YourEntityName
58+
`./gradlew deleteEntity -PentityName=YourEntityName`
5459

5560
### Building your own concept
5661
You can create your own concept by running a gradle command to scaffold the files you need.
5762

5863
run
59-
./gradlew createConcept -PconceptName=YourConceptName
64+
`./gradlew createConcept -PconceptName=YourConceptName`
6065

6166
The task will create the necessary files and print out their locations for you to go edit.
6267

6368
### Deleting a scaffolded concept
6469
If for some reason you need to delete a concept that you scaffolded, simply run this command.
6570
run
6671

67-
./gradlew deleteConcept -PconceptName=YourConceptName
72+
`./gradlew deleteConcept -PconceptName=YourConceptName`
6873

6974
The task will create the necessary files and print out their locations for you to go edit.
7075

7176
## Running the UI
7277
After installing Research Hub and a domain, you can start the ui using:
7378

74-
cd ui
75-
npm start
79+
`cd ui`
80+
`npm start`
81+
82+
If the start fails, it may be necessary to install the nodemon (Node Monitor), cross-env, and concurrently packages with `npm install nodemon`, `npm install cross-env`, and `npm install concurrently` respectively from the ui directory. Typically, these are installed with `-g` option which makes the packages globally available across all projects.
7683

7784
## Running Tests
7885
After installing Research Hub and a domain, you can run any tests that were created by going to http://localhost:8015/test/ (or http://localhost:8115/test/ if using our Docker setup), and using the UI there to run tests.

build.gradle

Lines changed: 28 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ import java.text.SimpleDateFormat;
22

33
buildscript {
44
repositories {
5-
maven {url 'http://developer.marklogic.com/maven2/'}
6-
mavenLocal()
7-
jcenter()
5+
// To use gradle in disconnected mode, you just need to set the 'disconnected' property. E.g. gradle compileJava -Pdisconnected
6+
if (project.hasProperty("disconnected") && !"FALSE".equalsIgnoreCase(disconnected)) {
7+
println "Using offline buildscript dependency repositories"
8+
maven { url uri(projectMavenRepo) }
9+
} else {
10+
println "Using online buildscript dependency repositories"
11+
maven {url 'https://developer.marklogic.com/maven2/'}
12+
mavenLocal()
13+
mavenCentral()
14+
}
815
}
916
dependencies {
10-
classpath "com.marklogic:marklogic-unit-test-client:1.0.0"
17+
classpath "com.marklogic:marklogic-unit-test-client:1.2.1"
1118
}
1219
}
1320

@@ -24,20 +31,28 @@ plugins {
2431
// See https://github.com/stevesaliman/gradle-properties-plugin
2532
// specify the env on the command line with:
2633
// gradle -PenvironmentName=x ...
27-
id 'net.saliman.properties' version '1.4.6'
34+
id 'net.saliman.properties' version '1.5.1'
2835

2936
// This gradle plugin extends the ml-gradle plugin with
3037
// commands that make the Data Hub Framework do its magic
31-
id 'com.marklogic.ml-data-hub' version '5.1.0'
38+
id 'com.marklogic.ml-data-hub' version '5.8.0'
3239
}
3340

3441
repositories {
35-
jcenter()
36-
maven {url 'http://developer.marklogic.com/maven2/'}
42+
// To use gradle in disconnected mode, you just need to set the 'disconnected' property. E.g. gradle compileJava -Pdisconnected
43+
if (project.hasProperty("disconnected") && !"FALSE".equalsIgnoreCase(disconnected)) {
44+
println "Using offline dependency repositories"
45+
maven { url uri(projectMavenRepo) }
46+
} else {
47+
println "Using online dependency repositories"
48+
mavenCentral()
49+
maven { url "https://developer.marklogic.com/maven2/" }
50+
}
3751
}
3852

3953
configurations {
40-
mlcp
54+
corb
55+
mlcp
4156
}
4257

4358
dependencies {
@@ -46,8 +61,8 @@ dependencies {
4661
mlBundle "com.marklogic:marklogic-unit-test-modules:1.0.0"
4762
}
4863

49-
compile 'com.marklogic:marklogic-data-hub:5.1.0'
50-
mlcp "com.marklogic:mlcp:10.0.2"
64+
corb "com.marklogic:marklogic-corb:2.4.1"
65+
mlcp "com.marklogic:mlcp:10.0.6.1"
5166

5267
if ("true".equalsIgnoreCase(project.findProperty("isDeployUnitTestFramework"))) {
5368
testCompile "com.marklogic:marklogic-unit-test-client:1.0.beta"
@@ -87,13 +102,14 @@ def buildTime() {
87102
return df.format(new Date())
88103
}
89104

90-
// Database client config for mlUnitTest
105+
/* Database client config for mlUnitTest
91106
ext {
92107
mlUnitTest.databaseClientConfig.host = mlHost
93108
mlUnitTest.databaseClientConfig.port = mlTestFinalPort.toInteger()
94109
mlUnitTest.databaseClientConfig.username = mlUsername
95110
mlUnitTest.databaseClientConfig.password = mlPassword
96111
}
112+
/*
97113
98114
/**
99115
* Delete a collection in the Final Database.
@@ -149,30 +165,6 @@ task createTestDirs {
149165
}
150166
}
151167

152-
if ("true".equalsIgnoreCase(project.findProperty("isDeployUnitTestFramework"))) {
153-
(new File(buildDir, "/test-results/marklogic-unit-tests")).mkdirs()
154-
def testStagingDbFile = new File(buildDir, "test-staging-database.json")
155-
testStagingDbFile.write(new File("src/main/hub-internal-config/databases/staging-database.json").text)
156-
157-
def testFinalDbFile = new File(buildDir, "test-final-database.json")
158-
testFinalDbFile.write(new File("src/main/ml-config/databases/final-database.json").text)
159-
160-
def newCommands = new ArrayList<>()
161-
for (def c : mlAppDeployer.commands) {
162-
newCommands.add(c)
163-
if (c instanceof com.marklogic.appdeployer.command.databases.DeployOtherDatabasesCommand) {
164-
newCommands.add(new DeployHubTestDatabaseCommand(hubConfig, testStagingDbFile, "staging-database.json", mlStagingDbName + "-TEST"))
165-
newCommands.add(new DeployHubTestDatabaseCommand(hubConfig, testFinalDbFile, "final-database.json", mlFinalDbName + "-TEST"))
166-
}
167-
// Loading roles in two phases breaks the preview feature, so it's disabled
168-
else if (c instanceof com.marklogic.hub.deploy.commands.DeployHubOtherServersCommand) {
169-
newCommands.add(new DeployHubTestServerCommand(dataHub, "staging-server.json", mlStagingAppserverName + "-TEST", mlTestStagingPort.toInteger(), mlStagingDbName + "-TEST"))
170-
newCommands.add(new DeployHubTestServerCommand(dataHub, "final-server.json", mlFinalAppserverName + "-TEST", mlTestFinalPort.toInteger(), mlFinalDbName + "-TEST"))
171-
}
172-
}
173-
mlAppDeployer.commands = newCommands
174-
}
175-
176168
task hubUndeployTestResources(type: com.marklogic.gradle.task.MarkLogicTask) {
177169
description = "Undeploys the test servers and databases that were created via hubDeployTestResources"
178170
doLast {
@@ -222,30 +214,6 @@ class DeployHubTestDatabaseCommand extends com.marklogic.hub.deploy.commands.Dep
222214
}
223215
}
224216

225-
class DeployHubTestServerCommand extends com.marklogic.hub.deploy.commands.DeployHubOtherServersCommand {
226-
String serverName
227-
int port
228-
String contentDatabaseName
229-
230-
DeployHubTestServerCommand(DataHub dataHub, String serverFilenamePattern, String serverName, int port, String contentDatabaseName) {
231-
super(dataHub)
232-
setResourceFilenamesIncludePattern(Pattern.compile(serverFilenamePattern))
233-
this.serverName = serverName
234-
this.port = port
235-
this.contentDatabaseName = contentDatabaseName
236-
}
237-
238-
@Override
239-
protected String copyFileToString(File f) {
240-
String payload = super.copyFileToString(f)
241-
ObjectNode node = new ObjectMapper().readTree(payload)
242-
node.set("server-name", new TextNode(serverName))
243-
node.set("port", new TextNode(port + ""))
244-
node.set("content-database", new TextNode(contentDatabaseName))
245-
return node.toString()
246-
}
247-
}
248-
249217
task clearStagingDatabase(type: com.marklogic.gradle.task.databases.ClearDatabaseTask) {
250218
doFirst {
251219
project.ext.database = project.properties.mlStagingDbName

buildSrc/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apply plugin: 'groovy'
22

33
repositories {
44
mavenCentral()
5-
jcenter()
65
}
76

87
dependencies {

examples/hr360/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ And add an import for `Skill`, and include it in the `export` section so it look
6565
workspace
6666
}
6767

68+
### Adding necessary indexes
69+
70+
Add to /gradle.properties a line to merge hr360 indexes with the base final database configuration:
71+
72+
`mlConfigPaths=src/main/ml-config,examples/hr360/src/main/ml-config`
73+
74+
This line will include the indexes defined in the `examples\hr360\src\main\ml-config\databases\final-database.json` file to the base version of the final database defined in `src\main\ml-config\databases\final-database.json`.
75+
76+
6877
### Build and deploy the changes
6978

7079
Use this commands to deploy all the changes and code to the backend:
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
{
2+
"database-name": "%%mlFinalDbName%%",
3+
"range-element-index": [
4+
{
5+
"scalar-type": "string",
6+
"namespace-uri": "",
7+
"localname": "requiredCompetency",
8+
"collation": "http://marklogic.com/collation/codepoint",
9+
"range-value-positions": false,
10+
"invalid-values": "reject"
11+
},
12+
{
13+
"scalar-type": "string",
14+
"namespace-uri": "",
15+
"localname": "departmentName",
16+
"collation": "http://marklogic.com/collation/codepoint",
17+
"range-value-positions": false,
18+
"invalid-values": "reject"
19+
},
20+
{
21+
"scalar-type": "string",
22+
"namespace-uri": "",
23+
"localname": "location",
24+
"collation": "http://marklogic.com/collation/codepoint",
25+
"range-value-positions": false,
26+
"invalid-values": "reject"
27+
},
28+
{
29+
"scalar-type": "string",
30+
"namespace-uri": "",
31+
"localname": "reasonType",
32+
"collation": "http://marklogic.com/collation/codepoint",
33+
"range-value-positions": false,
34+
"invalid-values": "reject"
35+
},
36+
{
37+
"scalar-type": "string",
38+
"namespace-uri": "",
39+
"localname": "category",
40+
"collation": "http://marklogic.com/collation/codepoint",
41+
"range-value-positions": false,
42+
"invalid-values": "reject"
43+
},
44+
{
45+
"scalar-type": "string",
46+
"namespace-uri": "",
47+
"localname": "languageSkills",
48+
"collation": "http://marklogic.com/collation/codepoint",
49+
"range-value-positions": false,
50+
"invalid-values": "reject"
51+
},
52+
{
53+
"scalar-type": "string",
54+
"namespace-uri": "",
55+
"localname": "toolSkills",
56+
"collation": "http://marklogic.com/collation/codepoint",
57+
"range-value-positions": false,
58+
"invalid-values": "reject"
59+
}
60+
]
61+
}

examples/hr360/src/main/ml-modules/options/employee.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,23 @@
9797
</range>
9898
</constraint>
9999
<constraint name="LanguageSkill">
100-
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/" >
100+
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint" >
101101
<facet-option>limit=10</facet-option>
102102
<facet-option>frequency-order</facet-option>
103103
<facet-option>descending</facet-option>
104104
<element ns="" name="languageSkills"/>
105105
</range>
106106
</constraint>
107107
<constraint name="ToolSkill">
108-
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/" >
108+
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint" >
109109
<facet-option>limit=10</facet-option>
110110
<facet-option>frequency-order</facet-option>
111111
<facet-option>descending</facet-option>
112112
<element ns="" name="toolSkills"/>
113113
</range>
114114
</constraint>
115115
<constraint name="ProductSkill">
116-
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/" >
116+
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint" >
117117
<facet-option>limit=10</facet-option>
118118
<facet-option>frequency-order</facet-option>
119119
<facet-option>descending</facet-option>

examples/hr360/src/main/ml-modules/options/jobopening.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
</constraint>
9090
-->
9191
<constraint name="RequiredCompetency">
92-
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/" >
92+
<range type="xs:string" facet="true" collation="http://marklogic.com/collation/codepoint" >
9393
<facet-option>limit=10</facet-option>
9494
<facet-option>frequency-order</facet-option>
9595
<facet-option>descending</facet-option>

0 commit comments

Comments
 (0)