Web tools - Web tools

webtools-intro

Welcome to OP webtools

  • Learn our services
  • Read our documentation

Asset Publisher

Widgets

Your publications in your website using OP widgets

A widget is a free and easy way to embed content from publications.europa.eu (EU Law, EU publications and Summaries of Legislation) into your website or blog.

Your website

Types of widgets

There are 5 types of widgets that can be embedded in a website:

1. Search form

Your users can launch a search on your site to find publications. In the widget settings you can pre-filter the search to limit the scope to a certain set of publications.

2. Result of a search

Either you set yourself a query and the results will show on the widget or you let your users launch a search with the Search Form Widget and the results of their search will appear on the Result of a Search Widget. In the later case, you will simply link the Search Form Widget to the Result Widget

3. Selected publications

You select the publications that you want to display

4. Publication detail

The widget will only show one publication, usually with more metadata: either a publication that you have selected or the publication selected by a user coming from a Selected publications widgets or Result of a Search Widget

5. Organization detail (WhoIsWho)

This widget will show the organizational structure of a European Institution, and the persons' hierarchical position.

Steps to create a widget

1. Sign-in

You need to login on publications.europa.eu. You can create a new account or sign-in with: ECAS, facebook, twitter, Google+, Linkedin and LiveId.

2. Create a widget

Go to my-widgets and create a new widget. You will have the possibility to set the following elements:

  • Name
    Name of your widget
  • Description
    will not be displayed on your website
  • Language policy
    Multilingual: to let the widget detect autmatically the language of your page; Use only one language: to create a widget in only one EU language
  • For Selected publications widget or Result of a search widget, you have to choose the metadata to display:
    • Title
    • Subtitle
    • Abstract
    • Date
    • Authors
    • Subjects
    • Formats
    • Thumbnail

3. Customize your widget

In the Appearance tab, you have several customization parameters to manage the look-and-feel of your widget. It can be aligned with your site.

4. Save your widget

Save your widget and copy/paste the embed code on your webpage.

5. Improve the widget

At any time you can modify the settings of your widget (on my-widgets). The modification will be visible on your site after the cache is cleared.

Widgets with json scripts

No more javascript in your articles

If your CMS prevents you from pasting javascript in your content (pages or articles), you can paste json script instead. The only requirement is to refer once for all to a javascript file in the head of your pages. This operation can be done by the Administrator of your site .

Step 1 : include the reference to the load.js in the head of your pages

example:


<head>

<script src="//europa.eu/webtools/load.js" type="text/javascript"></script>

</head>

Step 2 : create your widget and copy the json script

example:

<script type="application/json"> { "service": "opwidget", "widgetId": "1073" } </script>

Linked data

Linked data and SPARQL

Linked Data is a standard way to represent data on a wide range of topics. Publishing Linked Data makes it easier for developers to connect information from different sources, resulting in new and innovative applications. For example an application could combine data on dominant business sectors, environmental emissions and educational establishments to help you and your family choose a place to live.

FLINT SPARQL Query editor

The FLINT SPARQL Query editor is a tool for advanced search that uses a central database and dissemination points. CELLAR uses RDF, OWL and could be interrogated by quiries SPARQL. It aggregates data in a small window in a semantic way of relating data. The semantic technologies are developing since 20 years and need improvement.The whole must rely on standards using a common language (RDF) and works with standards of developing ontologies.

Cellar API

Cellar API

The CELLAR is the common repository of content managed by the Publications Office. It contains the files and the metadata of various collections of documents:

  • EU law
  • EU publications
  • Summaries of legislation

How does CELLAR work?

Key collections of EU information – legal content and general publications – can be fetched directly from the Publications Office’s common repository of metadata and content, the CELLAR, using the machine-readable SPARQL endpoint facility or the HTTP RESTful web services. CELLAR is powered by semantic technology and enables direct access to information stored as Linked Data. The CELLAR provides also an RSS feed in order to allow reusers to receive information about new documents that have been loaded into the repository or updates of existing data. The EU Law and Publications portal (http://publications.europa.eu) allows end users to access these collections either through the easy to use Linked Data wizard or via the Flint SPARQL editor https://op.europa.eu/en/linked-data.

RSS Service

RSS Service

The RSS service implemented in and available from the portal2012-services.war web application archive supports straight forward and conditional GET queries from RSS clients using the rss_2.0 protocol standard.

 

Service Architecture

The service was developed on top of the Spring Framework and ROME API in order to support request handling and RSS content construction.

Whenever an RSS request is received, its parameters are interpreted in order to get the corresponding SavedQuery details from the User Profiling database, execute that query to the IDOL service and return the newest relevant results as an rss_2.0 feed to the RSS client.

Also, the portal2012-services module depends on the portal2012-data-service module by referencing it in its project object model file.

Integration of RSS Service

The portal2012-services.war is packaged a Liferay Portlet war so it has to be deployed through Liferay's deployment process, but any servlets that are included in the application will receive requests starting from the ‘/portal2012-services' context path combined with the additional servlet mappings that are configured with the included servlets.

The servlet responsible for handling RSS requests is made available through the RSSController  which is a Spring Framework @Controller annotated class which contains a @RequestMapping annotated method with the context path mapping of ‘/savedQuery'. So, the RSS requests for a user's saved queries have to be issued to the address ‘http://liferay-host:port/portal2012-services/savedQuery'.

In order to obtain the RSS feed for a given saved query the following request parameters must be sent:

Parameter Name

Type     

Description

queryid

LONG

The saved query identifier, issued at the corresponding SavedQuery entity creation through the ‘Save Query' functionality in the search results page of the portal.

userid

STRING

Optional.

The identifier of the user that saved the query. This value is the same as the username with which a user autheniticates in the Portal.

hash

STRING

A control value generated when the SavedQuery entity is created.

The link containing all the above mentioned parameters is generated and stored in the SavedQuery entity when a user specifies in the search results page or the ‘My Portal' page that the query he is saving should also be accessed through RSS.

Short URL service

Short URL service

The Short URL service is meant to be used by users to create shorter URL for document detail page. Thus, the URL won't be trimmed by other applications, preventing broken links.

Short URL service

The service is defined in portal2012-data module and it persists in the database URL's with an id. To make it easier for portlets to create short URL's, a helper class is available (named "ShortUrlHelper") in portal2012-portlet module. The method createShortUrl(String url) found in this class persists the url and returns a case sensitive string id, representing a long value encoded in base 62.

The redirection to the real URL is made in a filter implemented in portal2012-hook module. The filter is mapped on "/s/*" patterns, matching every URL that starts with "/s/". After this string, the short URL identifier is found.

In the processFilter method, the real URL is searched in the service, based on the decoded short URL id, then the user is redirected to the requested document detail page.

Permanent links and redirections

Permanent links and redirections

Permanent links are saved publications links that enable users to bookmark a publication and go back to it later or share it by clicking on the permanent link function on the top right of the search result or publication detail page.

Each general publication has a permanent link and automatic redirections based on publications identifiers.

The identifier code can be one of the following: catalogue number (s), ISBN, ISSN and DOI.

 

Permanent links and redirections

Example:

 

 

will all bring you to the publication - "Digital footprint in a mobile environment".

As for EU law publications, you can also use the CELEX redirection : 

 

 

  • permanent link : 

 

List of other web services

Services provided by PO-PROFILING-SERVICES can be executed by issuing HTTP commands on service URL.

Http commands that can be issued are:

  • GET – to retrieve single result or a list of results
  • PUT – to save or update profiling information
  • DELETE – to remove a specific profiling information

Parameters of the services are divided in two categories:

  • Path parameters – are parameters for which the value is retrieved from the URL path
  • Query parameters – are parameters for which the value is retrieve from http request parameters.

The result of each PO-PROFILING-SERVICES services invocation represents a well formed XML of java object serialized with JAXB and it is composed from two parts:

  • A response header part which contains the outcome of the invocation (if it was successful or not) and about the list of error, warning and information messages generated by the invocation
  • A response body that contains the actual result.

The definition of PO-PROFILING-SERVICES is provided as a WADL (Web Application Description Language) file together with an XML schema that contains the definition of the messages.

SPARQL queries

Samples of SPARQL queries

From the SPARQL Flint Editor (or directly from the SPARQL endpoint) you can launch your own queries to retrieve data from our collections.

Query 1 : Actions for failure of a Member Stat to fulfil its obligations (between 2006 and 2012)

The following query will return EU law documents where:

  • COM is the requester
  • a country (Member State) is the defendant
  • which concerns a directive
  • which concerns a failure to fulfil its obligations
  • where the procedure was successful (the Member State was condemned)

You can add a filter on '?year' to get only the ten most recent ones. Then just add FILTER(?year>'2006') before the last "}".


prefix cdm: <https://publications.europa.eu/ontology/cdm#> select
?year
?defender
 (count (distinct ?s) as ?counts)
where {?s  cdm:case-law_has_procjur
<http://publications.europa.eu/resource/authority/procjur/ACTION_FAIL_OBLIG>.
?s cdm:case-law_states_failure_concerning_resource_legal ?dir_.
?dir_ cdm:resource_legal_id_celex ?dir.
?s cdm:case-law_requested_by_agent
<http://publications.europa.eu/resource/authority/fd_110/COMM>.
?s cdm:case-law_defended_by_agent ?defender.
FILTER(substr(str(?dir),6,1)='L')
?bn owl:annotatedSource ?s.
?bn owl:annotatedTarget
<http://publications.europa.eu/resource/authority/procjur/ACTION_FAIL_OBLIG>.
?bn
<https://publications.europa.eu/ontology/annotation#result_decision>
<http://publications.europa.eu/resource/authority/procresult/APPL_GRANT>.
FILTER(?defender=<http://publications.europa.eu/resource/authority/fd_110/AT>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/BE>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/BG>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/CY>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/CZ>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/DE>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/DK>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/EE>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/EL>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/ES>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/FI>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/FR>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/HRV>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/HU>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/IE>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/IRL>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/IT>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/LT>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/LU>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/LV>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/MT>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/NL>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/PL>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/PT>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/RO>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/SE>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/SF>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/SI>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/SK>||
?defender=<http://publications.europa.eu/resource/authority/fd_110/UK>)
?s cdm:work_date_document ?date.
BIND(substr(str(?date),1,4) as ?year)
} group by ?defender ?year
order by desc(?year) ?defender

Query 2 : Top 30 of most used Eurovoc terms to tag EU law and EU publications

This query will list the Eurovoc terms sorted by the number of times they tag a publication from both collections : EU Law and EU publications.

prefix cdm:<https://op.europa.eu/ontology/cdm#>
prefix skos:<http://www.w3.org/2004/02/skos/core#>
select ?o ?label (count(distinct ?s) as ?nbWorks)
where {?s cdm:work_is_about_concept_eurovoc ?o.
?o skos:prefLabel ?label.    FILTER(lang(?label)='en')    }
group by ?o ?label    order by desc(count(distinct ?s))     limit 30