-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#123 Can now generate ES model artifacts
- Loading branch information
Showing
9 changed files
with
127 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This project shows where Entity Services (part of ML9) model definitions can be stored so that ml-gradle can be used | ||
to generate artifacts for the models. Generating artifacts depends on the application having been deployed | ||
already as a REST API server is required. Thus, a typical workflow is: | ||
|
||
1. Stub out a project with a build.gradle and gradle.properties file | ||
2. Run "gradle mlDeploy" to deploy the application | ||
3. Create one or more model definitions in ./data/entity-services | ||
4. Run "gradle mlGenerateModelArtifacts" (should be able to abbreviate it as "gradle mlgen") to use Entity Services | ||
to generate model artifacts for each of the model definitions | ||
5. Run "gradle mlDeploy" to deploy all of the model artifacts, which will include creating a schemas database if one | ||
doesn't exist already | ||
|
||
You can of course shorten the last 2 steps to "gradle mlgen mldeploy". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
plugins { | ||
id "com.marklogic.ml-gradle" version "2.5.0" | ||
} |
84 changes: 84 additions & 0 deletions
84
examples/entity-services-project/data/entity-services/race.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"info": { | ||
"title": "Race", | ||
"version": "0.0.1", | ||
"baseUri": "http://grechaw.github.io/entity-types", | ||
"description":"This schema represents a Runner who runs Runs and has the potential of winning Races. We'll start with this entity-type, then decide on and populate instances, tie the data in with an external RDF-based model, and query it. There are interesting problems with the bare-bones approach in this entity-type." | ||
}, | ||
"definitions": { | ||
"Race": { | ||
"properties": { | ||
"name": { | ||
"datatype": "string", | ||
"description":"The name of the race." | ||
}, | ||
"comprisedOfRuns": { | ||
"datatype": "array", | ||
"description":"An array of Runs that comprise the race.", | ||
"items":{ | ||
"$ref": "#/definitions/Run" | ||
} | ||
}, | ||
"wonByRunner": { | ||
"$ref":"#/definitions/Runner", | ||
"description":"The (single) winner of the race. (rule) Should match the run of shortest duration." | ||
}, | ||
"courseLength": { | ||
"datatype":"decimal", | ||
"description":"Length of the course in a scalar unit (decimal miles)" | ||
} | ||
}, | ||
"primaryKey":"name" | ||
}, | ||
"Run": { | ||
"properties": { | ||
"id": { | ||
"datatype": "string", | ||
"description":"A unique id for the run. maybe date/runByRunner (assumes one run per day per person)" | ||
}, | ||
"date": { | ||
"datatype": "date", | ||
"description":"The date on which the run occurred." | ||
}, | ||
"distance": { | ||
"datatype": "decimal", | ||
"description":"The distance covered, in a scalar value." | ||
}, | ||
"distanceLabel": { | ||
"datatype": "string", | ||
"description":"The distance covered, in a conventional notation." | ||
}, | ||
"duration": { | ||
"datatype": "dayTimeDuration", | ||
"description":"The duration of the run." | ||
}, | ||
"runByRunner": { | ||
"$ref": "#/definitions/Runner" | ||
} | ||
}, | ||
"primaryKey":"id", | ||
"required":["date","distance","duration","runByRunner"], | ||
"rangeIndex":["date", "distance", "duration", "runByRunner"] | ||
}, | ||
"Runner": { | ||
"properties": { | ||
"name": { | ||
"datatype": "string", | ||
"description":"The name of the runner. In this early model, unique and a PK." | ||
}, | ||
"age": { | ||
"datatype": "int", | ||
"description":"age, in years." | ||
}, | ||
"gender" : { | ||
"datatype" : "string", | ||
"description": "The gender of the runner (for the purposes of race categories.)" | ||
} | ||
}, | ||
"primaryKey": "name", | ||
"wordLexicon": ["name"], | ||
"required": ["name", "age"] | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
mlHost=localhost | ||
mlAppName=es-gradle-example | ||
mlRestPort=82345 | ||
mlUsername=admin | ||
mlPassword=admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
group=com.marklogic | ||
version=2.4.0 | ||
mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.4.0 | ||
version=es2 | ||
mlAppDeployerDependency=com.marklogic:ml-app-deployer:es2 | ||
mlcpUtilDependency=com.marklogic:mlcp-util:0.3.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/groovy/com/marklogic/gradle/task/es/GenerateModelArtifactsTask.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.marklogic.gradle.task.es | ||
|
||
import com.marklogic.appdeployer.command.es.GenerateModelArtifactsCommand | ||
import com.marklogic.gradle.task.MarkLogicTask | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
class GenerateModelArtifactsTask extends MarkLogicTask { | ||
|
||
@TaskAction | ||
void generateModelArtifacts() { | ||
new GenerateModelArtifactsCommand().execute(getCommandContext()) | ||
} | ||
} |