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

URI as result field #35

Open
david-batranu opened this issue Sep 3, 2013 · 5 comments
Open

URI as result field #35

david-batranu opened this issue Sep 3, 2013 · 5 comments

Comments

@david-batranu
Copy link

result_display formatting doesn't work and filters don't show when URIs are used as field names, for example, in the result below, "http://purl.org/dc/terms/creator" is used instead of "author", since currently the code assumes . is used to get data from an object, the split turns http://purl.org/dc/terms/creator into ["http://purl", "org/dc/terms/creator"] and breakes the functionality.

I forked the code and did a quick fix but my fix will not allow things like http://purl.org/dc/terms/creator.first_name to work, since it skips the split.

In the fix some jQuery selectors have been replaced with [id=""] syntax, as selectors like jQuery('#facetview_http_//purl_org/dc/terms/creator') don't seem to work using the standard syntax.

      {
        "_index": "rdfdata",
        "_type": "resource",
        "_id": "http://www.eea.europa.eu/highlights/check-last-year2019s-water-quality-in-your-favourite-bathing-spot",
        "_score": 1.0,
        "_source": {
          "http://www.eea.europa.eu/portal_types/Highlight#media": "http://www.eea.europa.eu/highlights/check-last-year2019s-water-quality-in-your-favourite-bathing-spot/image_xlarge",
          "http://rdfdata.eionet.europa.eu/amp/ontology/managementPlan": "2011",
          "http://www.eea.europa.eu/portal_types/Highlight#publishDate": "2008-06-02T08:00:00.0",
          "http://www.w3.org/2000/01/rdf-schema#label": "Check last year's water quality in your favourite bathing spot",
          "http://www.eea.europa.eu/portal_types/Highlight#text": "<p>With WISE, users can check the water quality on an interactive map. They can also select a country or a region, download the data for their selection and make comparisons with previous years. The downloaded data can also be visualised in geospatial mapping programmes such as Google Earth and Microsoft Live maps.</p> <p>WISE is a partnership between the European Commission (DG Environment, Joint Research Centre and Eurostat) and the European Environment Agency, closely collaborating with EU Member States. An annual assessment of the bathing water quality in the EU will be presented today by the European Commission.</p> <h3>State of bathing water<br /></h3> <ul><li><a href='http://www.eea.europa.eu/themes/water/status-and-monitoring/state-of-bathing-water/state/state-of-bathing-water' class='external-link'>Visit EEA's thematic site on 'state of bathing water'</a></li></ul> <p>&nbsp;</p> <h3>See also</h3> <ul><li>European Commission's press release: <a class='external-link' href='http://europa.eu/rapid/pressReleasesAction.do?reference=IP/08/834&amp;format=HTML&amp;aged=0&amp;language=EN&amp;guiLanguage=en'>&nbsp;Bathing water quality in the EU remains high<br /></a></li></ul> <p>&nbsp;</p>",
          "http://purl.org/dc/terms/title": "Check last year's water quality in your favourite bathing spot",
          "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [
            "http://rdfdata.eionet.europa.eu/amp/ontology/Output",
            "http://purl.org/ontology/bibo/Webpage",
            "http://www.eea.europa.eu/portal_types/Highlight#Highlight"
          ],
          "http://www.eea.europa.eu/portal_types/Highlight#themes": [
            "coast_sea",
            "water"
          ],
          "http://purl.org/dc/terms/modified": "2011-04-13T17:17:40.0",
          "http://www.eea.europa.eu/portal_types/Highlight#id": "check-last-year2019s-water-quality-in-your-favourite-bathing-spot",
          "http://purl.org/dc/terms/created": "2008-05-30T11:55:18.0",
          "http://purl.org/dc/terms/creator": "karadgu",
          "http://www.eea.europa.eu/portal_types/Highlight#management_plan": "2011",
          "http://www.eea.europa.eu/portal_types/Highlight#visibilityLevel": "middle",
          "http://purl.org/dc/terms/issued": "2008-06-02T08:00:00.0",
          "http://purl.org/dc/terms/isPartOf": "http://www.eea.europa.eu/highlights",
          "http://cr.eionet.europa.eu/ontologies/contreg.rdf#tag": [
            "coast_sea",
            "water"
          ],
          "http://purl.org/dc/terms/description": "The 'Water Information System for Europe' (WISE) now allows users to view the quality of the bathing water in more than 21 000 coastal beaches and freshwater bathing sites across Europe during the 2007 bathing season. WISE also includes new information on urban wastewater treatment and water quality in European lakes and rivers."
        }
      },
@markmacgillivray
Copy link
Contributor

HI, yes the result_display method of displaying results is quite basic. For more complex displays - or as in this case for displays of data with complex keys, it would probably be better to use the post_search hook to get the result data into a custom js function that builds the result object onto the page in the desired way, and not bother using the result_display structure at all.

@demarant
Copy link

demarant commented Sep 4, 2013

@markmacgillivray , thanks!
I just want to give some context on why we have URI as keys for anybody interested for semantic/RDF data indexing.

our overall architecture is as follow. we are using a RDF store (openlink virtuoso) as an integration server where we have data from many systems. Than we are creating a Semantic RDF River Plugin for Elasticsearch (https://github.com/eea/eea.elasticsearch.river.rdf) that can query SPARQL endpoints and index RDF data into ES. Than we are trying to use the okfn facetview to give a nice faceted search to the end-users.

This is already working nicely except from the fact that keys from a semantic point of view are URI so that we can distinguish between two fields with same representation but different meanings, e.g. http://xmlns.com/foaf/0.1/Person#name vs http://myownvocabulary.com/vocab/Chemical#name
one is the name for a person the other is a name for a chemical ... therefore URI containing the namespace (=ontology context) will differentiate these two field and we avoid clashes.

My aim as manager of this project at EEA is to contribute to this okfn product and avoid keeping a fork of it...so I really hope we can improve the original facetview to be more robust and flexible concerning the result data having more RDF alike values like URIs or json-ld style, making facetview displaying linked data a become a nice tool for building semantic web applications.

@mihneasim
Copy link
Contributor

it would probably be better to use the post_search hook

If I'm not mistaking, the call of post_search is not properly implemented - the this object is the jQuery Ajax call object itself, it doesn't hold the response object or parsed search results.

options.post_search_callback.call(this);

this is jQuery.ajax() closure and can not be used to render results.

@markmacgillivray
Copy link
Contributor

By the time the callback runs though, the query has executed and dumped the result data into the options. So you can write a callback that refers to the options of the facetview instantiated on the element, and get all the data you need from there.

@mihneasim
Copy link
Contributor

Thanks, I didn't think that through :)

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

4 participants