Bug 2083 - Add inflectional paradigms for hits
Summary: Add inflectional paradigms for hits
Alias: None
Product: satni.org
Classification: Unclassified
Component: Web app (show other bugs)
Version: unspecified
Hardware: All All
: P4 - Within a month normal
Assignee: Børre Gaup
Depends on:
Reported: 2015-09-17 14:22 CEST by Børre Gaup
Modified: 2019-10-02 01:02 CEST (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Børre Gaup 2015-09-17 14:22:31 CEST
It would be very nice to present the inflectional paradigms beside a hit. An example of how it could be done is this: http://sanit.oahpa.no/detail/sme/nob/guolli.html?no_compounds=true&lemma_match=true&e_node=6051707933484830156
Comment 1 Tomi Pieski 2015-09-21 10:48:39 CEST
Nice. Do you have REST call for getting paradigm?
Comment 2 Børre Gaup 2015-09-21 12:59:38 CEST
I doubt that it exists, but I suspect Ryan knows more about it.
Comment 3 Ryan Johnson 2015-09-21 20:59:42 CEST
There is ;) 


It may need a little work, but try it out for a while and tell me what else you need from it and I can extend it a little.
Comment 4 Tomi Pieski 2015-09-22 15:05:45 CEST
I get CORS error:

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404
Comment 5 Ryan Johnson 2015-09-22 17:15:59 CEST
(In reply to Tomi Pieski from comment #4)
> I get CORS error:
> No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost:3000' is therefore not allowed access.
> The response had HTTP status code 404

Same result with a GET request? I can access this with cURL, so it should work. If it continues not to I can make some sort of jsonp parameter for this.
Comment 6 Tomi Pieski 2015-09-22 18:11:56 CEST
It is a GET request.
You need to add 'Access-Control-Allow-Origin' *  to the server response header, I think. What is the server? socket.io?
Comment 7 Tomi Pieski 2015-09-22 18:16:35 CEST
Here is the error I get:
XMLHttpRequest cannot load http://sanit.oahpa.no/paradigm/sme/nob/iskan. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
Comment 8 Tomi Pieski 2016-03-04 14:59:56 CET
This will be fixed from the server-side. I have no knowledge where this magical inflection paradigm generator is located.

It actually could be possible to connect when the satni is deployed to gtweb, but it needs to be tested in that environment.

I did some research, so if you have any of the following servers, here are instructions to fix this issue:

To add the CORS authorization to the header using Apache, simply add the following line inside either the <Directory>, <Location>, <Files> or <VirtualHost> sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file:

    Header set Access-Control-Allow-Origin "*"

Tomcat, Jetty (java based servers):


The following Nginx configuration enables CORS, with support for preflight requests.

# Wide-open CORS config for nginx
location / {
     if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        # Om nom nom cookies
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        # Custom headers and headers various browsers *should* be OK with but aren't
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
        # Tell client that this pre-flight info is valid for 20 days
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain charset=UTF-8';
        add_header 'Content-Length' 0;
        return 204;
     if ($request_method = 'POST') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
     if ($request_method = 'GET') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';


app.use(function(req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

If you use CGI:

print header(
  -type => 'text/turtle',
  -content_location => 'mydata.ttl',
  -access_control_allow_origin => '*',

In python:

print "Content-Type: text/turtle"
print "Content-Location: mydata.ttl"
print "Access-Control-Allow-Origin: *"

Add the following to the builder

enable 'CrossOrigin', origins => '*';

PHP (unless you have access to apache AND you still find yourself using PHP, but why??!!??):

 header("Access-Control-Allow-Origin: *");
Comment 9 Sjur Nørstebø Moshagen 2017-02-10 11:08:43 CET
Moving satni.org bugs from the Dictionaries product to the satni.org product.
Comment 10 Tomi Pieski 2017-04-04 13:21:30 CEST
Any progress with this?
Comment 11 Børre Gaup 2017-04-04 14:05:45 CEST
(In reply to Ryan Johnson from comment #3)
> There is ;) 
> http://sanit.oahpa.no/paradigm/sme/nob/guolli

This links gives this error:

Whoops! There was some kind of error.
argument 2 to map() must support iteration
Comment 12 Sjur Nørstebø Moshagen 2017-04-10 13:57:01 CEST
Ryan, did you have time to look at the access problem Tomi had? When done, move this bug back to Tomi.
Comment 13 Sjur Nørstebø Moshagen 2019-10-02 01:02:57 CEST
Flytta over til Børre, ingen respons frå Ryan på fire år.