This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
implementation of uniform data format for IDA #111
Open
AsjadLFC
wants to merge
48
commits into
master
Choose a base branch
from
backend-implement-udf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
e7a3a10
feat(rdf sparql server): Uniform data server initialized! with Spring…
4d228be
feat(rdf sparql server): check route added, XML2RDF added
5905044
feat(rdf sparql server): XML to RDF converter done
32fbb15
SParQL endpoint created, with output in JSON format
1805ca9
artist name query check and JSON format output on controller
0df6bae
reads all the query, removed the unnecessary things
d87c61f
Merge pull request #76 from dice-group/sparql-query-endpoint-2
maqboolkhan 265e6ab
feat(rdf sparql server): gitignore update for IntelliJ
maqboolkhan 6239e80
Merge pull request #77 from dice-group/basic-rdf-sparql-server
maqboolkhan 1fb0e97
feat(rdf sparql server): Renamed files to Java standards
maqboolkhan 0e61828
feat(rdf sparql server): csv to rdf added
maqboolkhan 39b7a6d
Merge pull request #80 from dice-group/csv-adapter
maqboolkhan a1245e9
feat(rdf sparql server): XML file to RDF done
maqboolkhan db0e905
feat(rdf sparql server): CSV file to RDF done
maqboolkhan 68c40ce
feat(rdf sparql server): created a util for handling file
maqboolkhan 811dbbb
feat(rdf sparql server): Certain changes to make file upload more rel…
maqboolkhan 80a0067
Merge pull request #82 from dice-group/file-upload-conversion
maqboolkhan 07e7bc1
alternate approach for turtle datasets
AsjadLFC 9693cd1
Merge pull request #96 from dice-group/sparql-alternate-approach
maqboolkhan 0fce45c
code refactoring
maqboolkhan 8623494
sentence added for chatbot rivescript
maqboolkhan 51575e7
Added rivescript for dataset upload and actioncode so the UI can unde…
maqboolkhan 32e4378
Reverting back everything
maqboolkhan 95a4ec9
validation with file extension and file mime type added
maqboolkhan 10497b0
Merge pull request #98 from dice-group/basic-validations
maqboolkhan e545580
Merge branch 'uniform-dataset-format' into integration-with-ida
maqboolkhan 2a74fb1
response integration to/from UI for file
AsjadLFC b3e3cce
Modal dialog added for file upload
maqboolkhan bfeb849
Design added for file upload Modal dialog
maqboolkhan 0ad70af
dataset is now uploading successfully
maqboolkhan eba297f
successfull and failed upload file reponse added
maqboolkhan 8d2f003
code refactoring of file upload modal
maqboolkhan a1500c6
dataset upload set action code
AsjadLFC f0fb748
datset upload set action name
AsjadLFC 3fb12e1
dataset name properly saving
maqboolkhan fe470d0
upload manager added
05f9edf
controller made for different files controlling for upload of files b…
1cc5e30
solved uploading files
30e2cce
datasets show, load, and query
c5f17dc
endpoint created, upload, show, query made
bf3e03a
Resolving conflicts
maqboolkhan 4d3fa95
upload successfully without errors
eb02532
reposense sent back for fileMap
c3b2935
codacy issues resolve
cc4d46e
codacy isseus checking again
803ddf1
retesting codacy issues
a5c7bad
retesting codacy issues
feefefc
Merge branch 'master' into backend-implement-udf
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
3 changes: 3 additions & 0 deletions
3
ida-chatbot/src/app/components/dataset-upload-modal/dataset-upload-modal.component.css
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 @@ | ||
.file-name:disabled { | ||
color: #000; | ||
} |
24 changes: 24 additions & 0 deletions
24
ida-chatbot/src/app/components/dataset-upload-modal/dataset-upload-modal.component.html
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,24 @@ | ||
<h1 mat-dialog-title>Upload dataset</h1> | ||
<div mat-dialog-content> | ||
<form> | ||
<mat-form-field class="full-width"> | ||
<input matInput class="file-name" [value]="fileName" name="fileName" disabled> | ||
<mat-hint>You can only select CSV or XML file.</mat-hint> | ||
</mat-form-field> | ||
<br> | ||
<br> | ||
<button mat-stroked-button (click)="fileInput.click()" class="full-width"> | ||
<mat-icon>cloud_upload</mat-icon> | ||
<input #fileInput type="file" [hidden]="true" accept=".xml, .csv" (change)="fileManager($event)"/> | ||
</button> | ||
</form> | ||
</div> | ||
<br> | ||
<mat-dialog-actions align="end"> | ||
<button mat-button mat-dialog-close>Cancel</button> | ||
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. --> | ||
<button mat-stroked-button color="primary" [disabled]="!fileSelected || showProgress" (click)="uploadDataset()"> | ||
<mat-spinner *ngIf="showProgress" [diameter]="20" style="margin: auto"></mat-spinner> | ||
<span *ngIf="!showProgress">Upload</span> | ||
</button> | ||
</mat-dialog-actions> |
25 changes: 25 additions & 0 deletions
25
ida-chatbot/src/app/components/dataset-upload-modal/dataset-upload-modal.component.spec.ts
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,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DatasetUploadModalComponent } from './dataset-upload-modal.component'; | ||
|
||
describe('DatasetUploadModalComponent', () => { | ||
let component: DatasetUploadModalComponent; | ||
let fixture: ComponentFixture<DatasetUploadModalComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DatasetUploadModalComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DatasetUploadModalComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
ida-chatbot/src/app/components/dataset-upload-modal/dataset-upload-modal.component.ts
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,55 @@ | ||
import {Component, Inject, Input, OnInit} from '@angular/core'; | ||
import {HttpClient} from '@angular/common/http'; | ||
import {MAT_DIALOG_DATA, MatDialogRef, MatSnackBar} from '@angular/material'; | ||
|
||
@Component({ | ||
selector: 'app-dialog-modal', | ||
templateUrl: './dataset-upload-modal.component.html', | ||
styleUrls: ['./dataset-upload-modal.component.css'] | ||
}) | ||
export class DatasetUploadModalComponent implements OnInit { | ||
|
||
fileName = 'Select CSV or XML file...'; | ||
file; | ||
fileSelected = false; | ||
showProgress = false; | ||
|
||
constructor(@Inject(MAT_DIALOG_DATA) public data, | ||
private _http: HttpClient, | ||
public dialogRef: MatDialogRef<DatasetUploadModalComponent>, | ||
public snackBar: MatSnackBar) {} | ||
|
||
ngOnInit() { | ||
} | ||
|
||
fileManager(event) { | ||
if (event.target.files.length > 0) { | ||
this.fileSelected = true; | ||
this.file = event.target.files[0]; | ||
this.fileName = this.file.name; | ||
} | ||
} | ||
|
||
uploadDataset() { | ||
console.log(this.data.datasetName); | ||
this.showProgress = true; | ||
const formData = new FormData(); | ||
formData.append('file', this.file); | ||
formData.append('fileName', this.data.datasetName); | ||
this._http.post('http://localhost:8080/ida-ws/message/file', formData).subscribe( | ||
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. This |
||
(res) => { | ||
this.dialogRef.close(); | ||
this.snackBar.open('Dataset uploaded successfully', 'Close', { | ||
duration: 3000, | ||
}); | ||
}, | ||
(err) => { | ||
this.snackBar.open('Dataset upload failed! Please try again', 'Close', { | ||
duration: 3000, | ||
}); | ||
this.showProgress = false; | ||
} | ||
); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -7,7 +7,9 @@ html, body { | |
height: 100%; | ||
margin: 0; | ||
} | ||
|
||
.full-width { | ||
width: 100%; | ||
} | ||
.table-cls { | ||
margin: 15px; | ||
} | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package upb.ida.provider; | ||
|
||
import com.rivescript.macro.Subroutine; | ||
import org.apache.commons.io.FilenameUtils; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import upb.ida.bean.ResponseBean; | ||
|
||
import java.io.File; | ||
|
||
import static upb.ida.constant.IDALiteral.DS_PATH; | ||
|
||
|
||
@Component | ||
public class ShowDataset implements Subroutine { | ||
@Autowired | ||
private ResponseBean responseBean; | ||
|
||
public String call(com.rivescript.RiveScript rs, String[] args) { | ||
File directory = new File(DS_PATH); | ||
String[] files = directory.list(); | ||
String temp = "Datasets: "; | ||
for (String file: files) { | ||
temp = temp + FilenameUtils.removeExtension(file) + ", "; | ||
} | ||
|
||
responseBean.setChatmsg(DS_PATH); | ||
temp = temp.substring(0, temp.length() - 1); | ||
return temp; | ||
} | ||
} |
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,30 @@ | ||
package upb.ida.provider; | ||
|
||
import com.rivescript.macro.Subroutine; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import upb.ida.bean.ResponseBean; | ||
import upb.ida.constant.IDALiteral; | ||
|
||
import java.io.File; | ||
import java.util.Map; | ||
|
||
@Component | ||
public class UploadDataset implements Subroutine { | ||
@Autowired | ||
private ResponseBean responseBean; | ||
|
||
public String call(com.rivescript.RiveScript rs, String[] args) { | ||
String message = args[0].toLowerCase().trim(); | ||
Map<String, Object> dataMap = responseBean.getPayload(); | ||
dataMap.put("datasetName", message); | ||
String resp = IDALiteral.RESP_FAIL_ROUTINE; | ||
File file = new File(System.getProperty("user.dir") + "/upload-ds/" + message + ".ttl"); | ||
if (!file.exists()) { | ||
responseBean.setActnCode(IDALiteral.UIA_UPLOAD); | ||
responseBean.setPayload(dataMap); | ||
resp = IDALiteral.RESP_PASS_ROUTINE; | ||
} | ||
return resp; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Remove
console.log