{"action":"created","issue":{"url":"https://api.github.com/repos/mmisw/mmiorr/issues/366","labels_url":"https://api.github.com/repos/mmisw/mmiorr/issues/366/labels{/name}","comments_url":"https://api.github.com/repos/mmisw/mmiorr/issues/366/comments","events_url":"https://api.github.com/repos/mmisw/mmiorr/issues/366/events","html_url":"https://github.com/mmisw/mmiorr/issues/366","id":117627461,"number":366,"title":"space in term URI causes malformed SPARQL query","user":{"login":"carueda","id":556505,"avatar_url":"https://avatars.githubusercontent.com/u/556505?v=3","gravatar_id":"","url":"https://api.github.com/users/carueda","html_url":"https://github.com/carueda","followers_url":"https://api.github.com/users/carueda/followers","following_url":"https://api.github.com/users/carueda/following{/other_user}","gists_url":"https://api.github.com/users/carueda/gists{/gist_id}","starred_url":"https://api.github.com/users/carueda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carueda/subscriptions","organizations_url":"https://api.github.com/users/carueda/orgs","repos_url":"https://api.github.com/users/carueda/repos","events_url":"https://api.github.com/users/carueda/events{/privacy}","received_events_url":"https://api.github.com/users/carueda/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mmisw/mmiorr/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/mmisw/mmiorr/labels/Priority-High","name":"Priority-High","color":"FFFFFF"},{"url":"https://api.github.com/repos/mmisw/mmiorr/labels/query","name":"query","color":"FFFFFF"},{"url":"https://api.github.com/repos/mmisw/mmiorr/labels/xdomes","name":"xdomes","color":"5319e7"}],"state":"closed","locked":false,"assignee":{"login":"carueda","id":556505,"avatar_url":"https://avatars.githubusercontent.com/u/556505?v=3","gravatar_id":"","url":"https://api.github.com/users/carueda","html_url":"https://github.com/carueda","followers_url":"https://api.github.com/users/carueda/followers","following_url":"https://api.github.com/users/carueda/following{/other_user}","gists_url":"https://api.github.com/users/carueda/gists{/gist_id}","starred_url":"https://api.github.com/users/carueda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carueda/subscriptions","organizations_url":"https://api.github.com/users/carueda/orgs","repos_url":"https://api.github.com/users/carueda/repos","events_url":"https://api.github.com/users/carueda/events{/privacy}","received_events_url":"https://api.github.com/users/carueda/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-11-18T16:42:11Z","updated_at":"2015-11-19T01:25:41Z","closed_at":"2015-11-19T01:25:41Z","body":"(reported by Roy L., 2015-11-18)\r\n\r\n>One thing we noticed during testing is that some MMI URLs to deprecated CF Standard Names cause an error and traceback download, for example:\r\n>\r\n> [`http://mmisw.org/ont/cf/parameter/mole_fraction_of_chlorine dioxide_in_air`](http://mmisw.org/ont/cf/parameter/mole_fraction_of_chlorine dioxide_in_air) (note the space between chlorine and dioxide: this has been replaced by an accepted term with an underscore between chlorine and dioxide).\r\n>\r\n> Cheers, Roy.\r\n\r\nThe case above generates this response:\r\n```\r\nMALFORMED QUERY: Found <. Was expecting one of: BIND, BLANK_NODE_LABEL, DECIMAL, DOUBLE,\r\nFALSE, FILTER, GEO, GRAPH, INTEGER, MINUS, NIL-SYMBOL, OPTIONAL,\r\nQ_IRI_REF, QNAME, QNAME_NS, SELECT, SERVICE, STRING_LITERAL1,\r\nSTRING_LITERAL2, STRING_LITERAL_LONG1, STRING_LITERAL_LONG2, TEXTINDEX,\r\nTRUE, VALUES, VARNAME or punctuation '(', '+', '-', '[', '[]', '{', '}'.\r\n```"},"comment":{"url":"https://api.github.com/repos/mmisw/mmiorr/issues/comments/157917461","html_url":"https://github.com/mmisw/mmiorr/issues/366#issuecomment-157917461","issue_url":"https://api.github.com/repos/mmisw/mmiorr/issues/366","id":157917461,"user":{"login":"carueda","id":556505,"avatar_url":"https://avatars.githubusercontent.com/u/556505?v=3","gravatar_id":"","url":"https://api.github.com/users/carueda","html_url":"https://github.com/carueda","followers_url":"https://api.github.com/users/carueda/followers","following_url":"https://api.github.com/users/carueda/following{/other_user}","gists_url":"https://api.github.com/users/carueda/gists{/gist_id}","starred_url":"https://api.github.com/users/carueda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carueda/subscriptions","organizations_url":"https://api.github.com/users/carueda/orgs","repos_url":"https://api.github.com/users/carueda/repos","events_url":"https://api.github.com/users/carueda/events{/privacy}","received_events_url":"https://api.github.com/users/carueda/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T01:25:41Z","updated_at":"2015-11-19T01:25:41Z","body":"Fixed.  PR https://github.com/mmisw/mmiorr/pull/370\r\n\r\nOnt v.2.5.6 (201511181917)\r\n\r\nPrior to instantiating the SPARQL query, each involved entity URI having any spaces is \"fixed\" by replacing those spaces with underscores.\r\n\r\nA request like [`http://mmisw.org/ont/cf/parameter/mole_fraction_of_chlorine dioxide_in_air`](http://mmisw.org/ont/cf/parameter/mole_fraction_of_chlorine dioxide_in_air) does not cause a malformed query anymore.\r\n\r\nNote: although it would probably be more correct to respond with an explicit error, the practical solution\r\nis to just do this replacement and let the query be processed. This could be documented.\r\n\r\nRelevant information:\r\n  - http://stackoverflow.com/a/9056636/830737 \r\n  - http://answers.semanticweb.com/questions/8244/how-do-you-handle-non-iri-compatible-urirefs\r\n"}}