Skip to content
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

Add Any23 as extraction service #3

Open
jetschni opened this issue Mar 15, 2017 · 1 comment
Open

Add Any23 as extraction service #3

jetschni opened this issue Mar 15, 2017 · 1 comment

Comments

@jetschni
Copy link
Contributor

jetschni commented Mar 15, 2017

Example implementation see

 var service = 'http://fbwsvcdev.th-brandenburg.de:8080/any23/any23/';
var format = 'turtle';
var parms = '&fix=on&report=on';
$.ajax( service + '?format=' + format + '&uri=' + url + parms)

https://github.com/EduGraph/EduGraph-Preview/blob/dev-php-implementation/assets/js/any23.js

@jetschni jetschni changed the title Adding Any23 as extraction service Add Any23 as extraction service Mar 15, 2017
@jetschni
Copy link
Contributor Author

Example

fail(function (jqXHR, exception) {
                // Our error logic here
                var msg = '';
                if (jqXHR.status === 0) {
                    msg = 'Not connect.\n Verify Network.';
                }
                //Any23 Error Reporting
                else if (jqXHR.status == 400) {
                    msg = 'Bad Request: Missing or malformed input parameter.';
                } else if (jqXHR.status == 404) {
                    msg = 'Not Found: Malformed request IRI.';
                } else if (jqXHR.status == 406) {
                    msg = 'Not Acceptable:  None of the media types specified in the Accept header are supported.';
                } else if (jqXHR.status == 415) {
                    msg = 'Unsupported Media Type: Document body with unsupported media type was POSTed.';
                } else if (jqXHR.status == 501) {
                    msg = 'Not Implemented:  Extraction from input was successful, but yielded zero triples.';
                } else if (jqXHR.status == 502) {
                    msg = 'Bad Gateway: Input document from a remote server could not be fetched or parsed.';

                    var errorReporting = $.parseXML( responseText);
                    try {
                        responseText = jqXHR.responseText
                        var errorReporting = $.parseXML( responseText);
                    }
                    catch(err) {
                        //console.log(err);
                        var responseText = jqXHR.responseText + '</issueReport></report>';
                        var errorReporting = $.parseXML( responseText);
                    }
                    var message = $(errorReporting).find( "message").text();
                    var errorRaw = $(errorReporting).find( "error").text();
                    var rx = /([A-Z]+):[ \t]+'(.+)'/g;
                    var error;

                    while (error = rx.exec(errorRaw)) {
                        var errorCode = error[1];
                        var errorMessage = error[2];

                        if (errorCode == 'WARNING') {
                            cssClass = 'text-warning';
                            icon = 'warning';

                        }
                        else if (errorCode = 'ERROR') {
                            cssClass = 'text-danger';
                            icon = 'error';
                        }
                        else {
                            errorCode = 'Undefined error'
                            icon = 'error_outline';
                        }
                        $("#errorMessage > .list-group").append('<li class="list-group-item"><i class="material-icons ' + cssClass + '">' + icon + '</i>  <strong>' + errorCode + ':</strong>&nbsp;' + errorMessage + '</li>');
                    }

                    if(errorCode){
                        $("#errorMessage").show();
                    }
                }

                else if (jqXHR.status == 500) {
                    msg = 'Internal Server Error [500].';
                } else if (exception === 'parsererror') {
                    msg = 'Requested JSON parse failed.';
                } else if (exception === 'timeout') {
                    msg = 'Time out error.';
                } else if (exception === 'abort') {
                    msg = 'Ajax request aborted.';
                } else {
                    msg = 'Uncaught Error.\n' + jqXHR.responseText;
                }

https://github.com/EduGraph/EduGraph-Preview/blob/dev-php-implementation/assets/js/any23.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant