Friday, March 6, 2015

Linked Open Election Framework Implementation Guide for Nanotation

How to Publish Election Data in Nanotation

.

Subjects: , , ,

Introduction:

This guide will show you how to implement the Linked Open Election Data using Nanotation and the Linked Election Framework.

Nanotations, which are micro Turtle, are deployable from any social media/networking space or service that offers the ability to post plain text (Twitter Tweets, Facebook Posts, Google+ Posts, LinkedIn Posts, Blog Posts, Comments, Mailing List Posts etc.. ).

This guide assumes a basic knowledge of Nanotation. If you're new to the subject or just need some brushing up, we recommend that you read the Kingsley Idehen's post on Nanotation.

Solution:

  1. First thing to do is to define the article or post that will host the election data:

    	{
    
    		@prefix schema:   .
    		
    		<>
    		a schema:NewsArticle ;
    		
    	}
     
    Please note that you can also use other Schema.org classes like schema:Article,schema:TechArticle, schema:BlogPost, schema:ScholarlyArticle as the document type.

  2. Define the name and headline of the post.

     
    	{
    
    		@prefix schema:   .
    		
    		<>
    		a schema:NewsArticle ;
    		
    		schema:name "Election Results";
    		schema:headline "Election Results".
    	
    	}
     

  3. Embed the author's name and profile URI (eg. Google+, WebID-Profile, DBpedia, Freebase, etc) :

    	{
    
    		@prefix schema:   .
    		
    		<>
    		a schema:NewsArticle ;
    		
    		schema:name "Election Results";
    		schema:headline "Election Results";
    
    		schema:author [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		schema:creator [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	.
    	
    	}
    
     

  4. Annotate the data, tags or subject associated with the article. You can define as many as possible using entities in Wikipedia, Freebase and Linked Open Data (LOD), delimited with commas :

     	{
    
    		@prefix schema:   .
    		
    		<>
    		a schema:NewsArticle ;
    		
    		schema:name "Election Results";
    		schema:headline "Election Results";
    
    		schema:author [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		schema:creator [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		
    		schema:about [
    				  a schema:Thing ;
    				  schema:name "Election" ;
    				  schema:url  ;
    		
    		]	, 
    		
    		[
    				  a schema:Thing ;
    				  schema:name "Elections in Nigeria" ;
    				  schema:url  ;
    		
    		]	. 
    	
    	}
    
     
    We're going to finish by annotating all of the data we've asserted concerning the article's associated entities.

  5. Embed your news story or article within the attribute "articleBody" .

     	{
    
    		@prefix schema:   .
    		
    		<>
    		a schema:NewsArticle ;
    		
    		schema:name "Election Results";
    		schema:headline "Election Results";
    
    		schema:author [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		schema:creator [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		
    		schema:about [
    				  a schema:Thing ;
    				  schema:name "Election" ;
    				  schema:url  ;
    		
    		]	, 
    		
    		[
    				  a schema:Thing ;
    				  schema:name "Elections in Nigeria" ;
    				  schema:url  ;
    		
    		]	; 
    		
    		schema:articleBody "your story or article goes here" .
    	
    	}
    
     

  6. Embed the election results. See subsequent steps on how to embed election polling data.

  7. Define and setup your poll and add the election schema.

     
     	{
    
    		@prefix schema:   .
    		@prefix election:  .
    		
    		<>
    		a schema:NewsArticle, election:Poll ;
    		
    		schema:name "Election Results";
    		schema:headline "Election Results";
    
    		schema:author [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		schema:creator [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		
    		schema:about [
    				  a schema:Thing ;
    				  schema:name "Election" ;
    				  schema:url  ;
    		
    		]	, 
    		
    		[
    				  a schema:Thing ;
    				  schema:name "Elections in Nigeria" ;
    				  schema:url  ;
    		
    		]	; 
    		
    		schema:articleBody "your story or article goes here" .
    	
    	}
      
     

  8. Add and update the attributes of the poll and candidates

     	{
    
    		@prefix schema:   .
    		@prefix election:  .
    		
    		<>
    		a schema:NewsArticle, election:Poll ;
    		
    		schema:name "Election Results";
    		schema:headline "Election Results";
    
    		schema:author [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		schema:creator [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		
    		schema:about [
    				  a schema:Thing ;
    				  schema:name "Election" ;
    				  schema:url  ;
    		
    		]	, 
    		
    		[
    				  a schema:Thing ;
    				  schema:name "Elections in Nigeria" ;
    				  schema:url  ;
    		
    		]	; 
    		
    		schema:articleBody "your story or article goes here" ;
    		
    		election:hasElectionDate "2014-06-21"^^xsd:date ;
    		election:hasConstituency  ;
    		election:hasRegisteredVoters "733766"^^xsd:integer ;
    		election:hasAccreditedVoters "369257"^^xsd:integer ;
    		election:hasTotalBallots "360455"^^xsd:integer ;
    		election:hasInvalidBallots "10089"^^xsd:integer ;
    		election:hasValidBallots "350366"^^xsd:integer ;
    		election:hasViolence "false"^^xsd:boolean ;
    		election:isCandidate <#candidate1>, <#candidate2>, <#candidate3> ;
    		election:hasElectoralFraud "false"^^xsd:boolean .
    		
    		<#candidate1> a election:Candidate ;
    		schema:name "Ayodele Peter Fayose" ;
    		election:isOfPoliticalParty  ;
    		election:hasVotes "203090"^^xsd:integer ;
    		election:isElected "true"^^xsd:boolean .
    
    		<#candidate2> a election:Candidate ;
    		schema:name "John Olukayode Fayemi" ;
    		election:isOfPoliticalParty  ;
    		election:hasVotes "120433"^^xsd:integer ;
    		election:isElected "false"^^xsd:boolean .
    		
    		
    		<#candidate3> a election:Candidate ;
    		schema:name "Bamidele Michael Opeyemi" ;
    		election:isOfPoliticalParty  ;
    		election:hasVotes "18135"^^xsd:integer ;
    		election:isElected "false"^^xsd:boolean .
    	
    	
    	}
    
    
    	
     

  9. Finally, you can add the provider organization data. The url attribute should be the website URL of the news or blogger organization while the name of the organization is added to the name attribute:

    
     	{
    
    		@prefix schema:   .
    		@prefix election:  .
    		
    		<>
    		a schema:NewsArticle, election:Poll ;
    		
    		schema:name "Election Results";
    		schema:headline "Election Results";
    
    		schema:author [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		schema:creator [
    				  a schema:Person ;
    				  schema:name "Creator's name" ;
    				  schema:url  ;
    		
    		]	;
    		
    		schema:about [
    				  a schema:Thing ;
    				  schema:name "Election" ;
    				  schema:url  ;
    		
    		]	, 
    		
    		[
    				  a schema:Thing ;
    				  schema:name "Elections in Nigeria" ;
    				  schema:url  ;
    		
    		]	; 
    		
    		schema:articleBody "your story or article goes here" ;
    		schema:sourceOrganization 	[
    				  a schema:Organization ;
    				  schema:name "Your organization name" ;
    				  schema:url  ;
    		
    		]	; 
    
    		schema:provider [
    				  a schema:Organization ;
    				  schema:name "Your organization name" ;
    				  schema:url  ;
    		
    		]	;  
    		
    		election:hasElectionDate "2014-06-21"^^xsd:date ;
    		election:hasConstituency  ;
    		election:hasRegisteredVoters "733766"^^xsd:integer ;
    		election:hasAccreditedVoters "369257"^^xsd:integer ;
    		election:hasTotalBallots "360455"^^xsd:integer ;
    		election:hasInvalidBallots "10089"^^xsd:integer ;
    		election:hasValidBallots "350366"^^xsd:integer ;
    		election:hasViolence "false"^^xsd:boolean ;
    		election:isCandidate <#candidate1>, <#candidate2>, <#candidate3> ;
    		election:hasElectoralFraud "false"^^xsd:boolean .
    		
    		<#candidate1> a election:Candidate ;
    		schema:name "Ayodele Peter Fayose" ;
    		election:isOfPoliticalParty  ;
    		election:hasVotes "203090"^^xsd:integer ;
    		election:isElected "true"^^xsd:boolean .
    
    		<#candidate2> a election:Candidate ;
    		schema:name "John Olukayode Fayemi" ;
    		election:isOfPoliticalParty  ;
    		election:hasVotes "120433"^^xsd:integer ;
    		election:isElected "false"^^xsd:boolean .
    		
    		
    		<#candidate3> a election:Candidate ;
    		schema:name "Bamidele Michael Opeyemi" ;
    		election:isOfPoliticalParty  ;
    		election:hasVotes "18135"^^xsd:integer ;
    		election:isElected "false"^^xsd:boolean .
    		
    	
    	}
    
    
    	
    	
     

That is it.

Information:

References

- http://en.wikipedia.org/wiki/DBpedia

- http://en.wikipedia.org/wiki/SPARQL

- http://www.w3.org/TR/turtle/

- http://kidehen.blogspot.com/2015/01/review-publishing-for-everyone.html

- http://kidehen.blogspot.com/2014/07/nanotation.html

Keywords: linked data, election, semantic web, turtle

No comments:

Post a Comment