blob: 475333ec8dcbb498edb0d88db467756fe0599d88 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="SMILA/Documentation/Importing/Crawler/Web,SMILA/Documentation/Importing/DeltaCheck,SMILA/Documentation/TaskGenerators" />
<link rel="shortcut icon" href="http://wiki.eclipse.org/SMILA/Documentation/Importing/Crawler/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="http://wiki.eclipse.org/opensearch_desc.php" title="Eclipsepedia (English)" />
<link rel="alternate" type="application/rss+xml" title="Eclipsepedia RSS Feed" href="http://wiki.eclipse.org/index.php?title=Special:Recentchanges&amp;feed=rss" />
<link rel="alternate" type="application/atom+xml" title="Eclipsepedia Atom Feed" href="http://wiki.eclipse.org/index.php?title=Special:Recentchanges&amp;feed=atom" />
<title>SMILA/Documentation/Importing/Crawler/Web - Eclipsepedia</title>
<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "/skins/eclipsenova/novaWide.css?116"; /*]]>*/</style>
<link rel="stylesheet" type="text/css" media="print" href="http://wiki.eclipse.org/skins/eclipsenova/eclipsenovaPrint.css?116" />
<link rel="stylesheet" type="text/css" media="handheld" href="http://wiki.eclipse.org/skins/eclipsenova/handheld.css?116" />
<link rel="stylesheet" type="text/css" href="http://wiki.eclipse.org/skins/eclipsenova/Nova/css/header.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://wiki.eclipse.org/skins/eclipsenova/tabs.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://wiki.eclipse.org/skins/eclipsenova/Nova/css/visual.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://wiki.eclipse.org/skins/eclipsenova/Nova/css/layout.css" media="screen" />
<link rel="stylesheet" type="text/css" href="http://wiki.eclipse.org/skins/eclipsenova/Nova/css/footer.css" media="screen" />
<!--[if IE]><link rel="stylesheet" type="text/css" href="/skins/eclipsenova/IEpngfix.css" media="screen" /><![endif]-->
<!--[if lt IE 5.5000]><style type="text/css">@import "/skins/eclipsenova/IE50Fixes.css?116";</style> <![endif]-->
<!--[if IE 5.5000]><style type="text/css">@import "/skins/eclipsenova/IE55Fixes.css?116";</style><![endif]-->
<!--[if IE 6]><style type="text/css">@import "/skins/eclipsenova/IE60Fixes.css?116";</style><![endif]-->
<!--[if IE 7]><style type="text/css">@import "/skins/eclipsenova/IE70Fixes.css?116";</style><![endif]-->
<!--[if lt IE 7]><script type="text/javascript" src="/skins/common/IEFixes.js?116"></script>
<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
<script type= "text/javascript">/*<![CDATA[*/
var skin = "eclipsenova";
var stylepath = "/skins";
var wgArticlePath = "/$1";
var wgScriptPath = "";
var wgScript = "/index.php";
var wgServer = "http://wiki.eclipse.org";
var wgCanonicalNamespace = "";
var wgCanonicalSpecialPageName = false;
var wgNamespaceNumber = 0;
var wgPageName = "SMILA/Documentation/Importing/Crawler/Web";
var wgTitle = "SMILA/Documentation/Importing/Crawler/Web";
var wgAction = "view";
var wgRestrictionEdit = [];
var wgRestrictionMove = [];
var wgArticleId = "35060";
var wgIsArticle = true;
var wgUserName = null;
var wgUserGroups = null;
var wgUserLanguage = "en";
var wgContentLanguage = "en";
var wgBreakFrames = false;
var wgCurRevisionId = "285712";
var wgVersion = "1.12.0";
var wgEnableAPI = true;
var wgEnableWriteAPI = false;
/*]]>*/</script>
<script type="text/javascript" src="http://wiki.eclipse.org/skins/common/wikibits.js?116"><!-- wikibits js --></script>
<!-- Performance mods similar to those for bug 166401 -->
<script type="text/javascript" src="http://wiki.eclipse.org/index.php?title=-&amp;action=raw&amp;gen=js&amp;useskin=eclipsenova"><!-- site js --></script>
<!-- Head Scripts -->
<script type="text/javascript" src="http://wiki.eclipse.org/skins/common/ajax.js?116"></script>
<link rel="stylesheet" type="text/css" href="Web.html" /> </head>
<body class="mediawiki ns-0 ltr page-SMILA_Documentation_Importing_Crawler_Web">
<div id="globalWrapper">
<div id="column-one">
<!-- Eclipse Additions for the Top Nav start here M. Ward-->
<div id="header">
<div id="header-graphic">
<img src="http://wiki.eclipse.org/skins/eclipsenova/eclipse.png" alt="Eclipse Wiki">
</div>
<!-- Pulled 101409 Mward -->
<div class="portlet" id="p-personal">
<div class="pBody">
<ul>
<li id="pt-login"><a href="http://wiki.eclipse.org/index.php?title=Special:Userlogin&amp;returnto=SMILA/Documentation/Importing/Crawler/Web">Log in</a></li>
</ul>
</div>
</div>
<div id="header-icons">
<div id="sites">
<ul id="sitesUL">
<li><a href="http://www.eclipse.org"><img src="http://dev.eclipse.org/custom_icons/eclipseIcon.png" width="28" height="28" alt="Eclipse Foundation" title="Eclipse Foundation" /><div>Eclipse Foundation</div></a></li>
<li><a href="http://marketplace.eclipse.org"><img src="http://dev.eclipse.org/custom_icons/marketplace.png" width="28" height="28" alt="Eclipse Marketplace" title="Eclipse Marketplace" /><div>Eclipse Marketplace</div></a></li>
<li><a href="https://bugs.eclipse.org/bugs"><img src="http://dev.eclipse.org/custom_icons/system-search-bw.png" width="28" height="28" alt="Bugzilla" title="Bugzilla" /><div>Bugzilla</div></a></li>
<li><a href="http://live.eclipse.org"><img src="http://dev.eclipse.org/custom_icons/audio-input-microphone-bw.png" width="28" height="28" alt="Live" title="Live" /><div>Eclipse Live</div></a></li>
<li><a href="http://planeteclipse.org"><img src="http://dev.eclipse.org/large_icons/devices/audio-card.png" width="28" height="28" alt="PlanetEclipse" title="Planet" /><div>Planet Eclipse</div></a></li>
<li><a href="http://portal.eclipse.org"><img src="http://dev.eclipse.org/custom_icons/preferences-system-network-proxy-bw.png" width="28" height="28" alt="Portal" title="Portal" /><div>My Foundation Portal</div></a></li>
</ul>
</div>
</div>
</div>
<!-- NEW HEADER STUFF HERE -->
<div id="header-menu">
<div id="header-nav">
<ul> <li><a class="first_one" href="http://wiki.eclipse.org/" target="_self">Home</a></li> <li><a href="http://www.eclipse.org/downloads/" target="_self">Downloads</a></li>
<li><a href="http://www.eclipse.org/users/" target="_self">Users</a></li>
<li><a href="http://www.eclipse.org/membership/" target="_self">Members</a></li>
<li><a href="http://wiki.eclipse.org/index.php/Development_Resources" target="_self">Committers</a></li>
<li><a href="http://www.eclipse.org/resources/" target="_self">Resources</a></li>
<li><a href="http://www.eclipse.org/projects/" target="_self">Projects</a></li>
<li><a href="http://www.eclipse.org/org/" target="_self">About Us</a></li>
</ul>
</div>
<div id="header-utils">
<!-- moved the search window here -->
<form action="http://wiki.eclipse.org/Special:Search" >
<input class="input" name="search" type="text" accesskey="f" value="" />
<input type='submit' onclick="this.submit();" name="go" id="searchGoButton" class="button" title="Go to a page with this exact name if one exists" value="Go" />&nbsp;
<input type='submit' onclick="this.submit();" name="fulltext" class="button" id="mw-searchButton" title="Search Eclipsepedia for this text" value="Search" />
</form>
</div>
</div>
<!-- Eclipse Additions for the Header stop here -->
<!-- Additions and mods for leftside nav Start here -->
<!--Started nav rip here-->
<!-- these are the nav controls main page, changes etc -->
<div id="novaContent" class="faux">
<div id="leftcol">
<ul id="leftnav">
<!-- these are the page controls, edit history etc -->
<li class="separator"><a class="separator">Navigation &#160;&#160;</li>
<li id="n-mainpage"><a href="http://wiki.eclipse.org/Main_Page">Main Page</a></li>
<li id="n-portal"><a href="http://wiki.eclipse.org/Eclipsepedia:Community_Portal">Community portal</a></li>
<li id="n-currentevents"><a href="http://wiki.eclipse.org/Eclipsepedia:Current_events">Current events</a></li>
<li id="n-recentchanges"><a href="http://wiki.eclipse.org/Special:Recentchanges">Recent changes</a></li>
<li id="n-randompage"><a href="http://wiki.eclipse.org/Special:Random">Random page</a></li>
<li id="n-help"><a href="http://wiki.eclipse.org/Help:Contents">Help</a></li>
<li class="separator"><a class="separator">Toolbox &#160;&#160;</a></li>
<li id="t-whatlinkshere"><a href="http://wiki.eclipse.org/Special:Whatlinkshere/SMILA/Documentation/Importing/Crawler/Web">What links here</a></li>
<li id="t-recentchangeslinked"><a href="http://wiki.eclipse.org/Special:Recentchangeslinked/SMILA/Documentation/Importing/Crawler/Web">Related changes</a></li>
<!-- This is the toolbox section -->
<li id="t-upload"><a href="http://wiki.eclipse.org/Special:Upload">Upload file</a></li>
<li id="t-specialpages"><a href="http://wiki.eclipse.org/Special:Specialpages">Special pages</a></li>
<li id="t-print"><a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Importing/Crawler/Web&amp;printable=yes">Printable version</a></li> <li id="t-permalink"><a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Importing/Crawler/Web&amp;oldid=285712">Permanent link</a></li> </ul>
</div>
<!-- Additions and mods for leftside nav End here -->
<div id="column-content">
<div id="content">
<a name="top" id="top"></a>
<div id="tabs">
<ul class="primary">
<li class="active"><a href="Web.html"><span class="tab">Page</span></a></li>
<li><a href="http://wiki.eclipse.org/index.php?title=Talk:SMILA/Documentation/Importing/Crawler/Web&amp;action=edit"><span class="tab">Discussion</span></a></li>
<li><a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Importing/Crawler/Web&amp;action=edit"><span class="tab">View source</span></a></li>
<li><a href="http://wiki.eclipse.org/index.php?title=SMILA/Documentation/Importing/Crawler/Web&amp;action=history"><span class="tab">History</span></a></li>
<li><a href="http://wiki.eclipse.org/index.php?title=Special:Userlogin&amp;returnto=SMILA/Documentation/Importing/Crawler/Web"><span class="tab">Edit</span></a></li>
</ul>
</div>
<script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
<h1 class="firstHeading">SMILA/Documentation/Importing/Crawler/Web</h1>
<div id="bodyContent">
<h3 id="siteSub">From Eclipsepedia</h3>
<div id="contentSub"><span class="subpages">&lt; <a href="../../../../SMILA.html" title="SMILA">SMILA</a> | <a href="../../../Documentation.1.html" title="SMILA/Documentation">Documentation</a></span></div>
<div id="jump-to-nav">Jump to: <a href="Web.html#column-one">navigation</a>, <a href="Web.html#searchInput">search</a></div> <!-- start content -->
<p>Currently, the web crawler workers are implemented very simplistic so that we can test the importing framework. A more sophisticated implementation will follow soon (hopefully).
</p>
<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="Web.html#Web_Crawler_Worker"><span class="tocnumber">1</span> <span class="toctext">Web Crawler Worker</span></a>
<ul>
<li class="toclevel-2"><a href="Web.html#Internal_structure"><span class="tocnumber">1.1</span> <span class="toctext">Internal structure</span></a></li>
<li class="toclevel-2"><a href="Web.html#Example_implementation"><span class="tocnumber">1.2</span> <span class="toctext">Example implementation</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="Web.html#Web_Fetcher_Worker"><span class="tocnumber">2</span> <span class="toctext">Web Fetcher Worker</span></a></li>
</ul>
</li>
</ul>
</td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<a name="Web_Crawler_Worker"></a><h3> <span class="mw-headline"> Web Crawler Worker </span></h3>
<ul><li> Worker name: <tt>webCrawler</tt>
</li><li> Parameters:
<ul><li> <tt>dataSource</tt>: name of data source, used only to mark produced records currently.
</li><li> <tt>startUrl</tt>: URL to start crawling at. Must be a valid URL, no additional escaping is done.
</li><li> <tt>filter</tt>: A map containing link filter settings, i.e. instructions which links to include or exclude from the crawl. This parameter is optional. At the moment, it can contain a single setting:
<ul><li> <tt>urlPrefix</tt>: Include only links that start with exactly this string (case-sensitive).
</li></ul>
</li></ul>
</li><li> Task generator: <tt><a href="../../TaskGenerators.html#RunOnceTriggerTaskGenerator" title="SMILA/Documentation/TaskGenerators">runOnceTrigger</a></tt>
</li><li> Input slots:
<ul><li> <tt>linksToCrawl</tt>: Records describing links to crawl.
</li></ul>
</li><li> Output slots:
<ul><li> <tt>linksToCrawl</tt>: Records describing outgoing links from the crawled resources. Should be connected to the same bucket as the input slot.
</li><li> <tt>crawledRecords</tt>: Records describing crawled resources. For resources of mimetype <tt>text/html</tt> the records have the content attached. For other resources, use a webFetcher worker later in the workflow to get the content.
</li></ul>
</li></ul>
<a name="Internal_structure"></a><h4> <span class="mw-headline"> Internal structure </span></h4>
<p>To make it easier to extend and improve the web crawler it is divided internally into components. Each of them is a single OSGi service that handles one part of the crawl functionality and can be exchanged individually to improve a single part of the functionality. The architecture looks like this:
</p><p><a href="http://wiki.eclipse.org/Image:SMILA-Importing-Web-Crawler-Internal.png" class="image" title="Image:SMILA-Importing-Web-Crawler-Internal.png"><img alt="Image:SMILA-Importing-Web-Crawler-Internal.png" src="http://wiki.eclipse.org/images/5/5c/SMILA-Importing-Web-Crawler-Internal.png" width="960" height="720" border="0" /></a>
</p><p>The WebCrawler worker is started with one input bulk that contains records with URLS to crawl. (The exception to this rule is the start of the crawl process where it gets a task without an input bulk, which causes it to generate an input record from the task parameters or configuration in a later version.). Then the components are executed like this:
</p>
<ul><li> First a <tt>VisitedLinksService</tt> is asked if this link was already crawled by someone else in this crawl job run. If so, the record is just dropped and no output is produced.
</li><li> Otherwise, the <tt>Fetcher</tt> is called to get metadata and content, if the content type of the resource is suitable for link extraction. Else the content will only be fetched in the WebFetcher worker later in the crawl workflow to save IO load.
</li><li> If the resource could be fetched without problems, the <tt>RecordProducer</tt> is called to decide if this record should be written to the <tt>crawledLinks</tt> output bulk. The producer could also modify the records or split them into multiple records, if necessary for the use case.
</li><li> If the content of the resource was fetched, the <tt>LinkExtractor</tt> is called to extract outgoing links (e.g. look for &lt;A&gt; tags). It can produce multiple link records containing one absolute outgoing URL each.
</li><li> If outgoing links were found the <tt>LinkFilter</tt> is called to remove links that should not be followed (e.g. because they are on a different site) or remove duplicates.
</li></ul>
<p>Finally, when all records from an input bulk have been processed, all links visited in this task must be marked as "visited" in the <tt>VisitedLinksService</tt>.
</p><p>Outgoing links are separated into multiple bulks to improve scaling: The outgoing links from the initial task that crawls the <tt>startUrl</tt> will be written to an own bulk each, while outgoing links from later tasks will be separated into bulks of 10 links each. The crawled records are divided into bulks of 100 records at most, but this will usually not have an effect as each incoming link produces one record at most.
</p>
<a name="Example_implementation"></a><h4> <span class="mw-headline"> Example implementation </span></h4>
<p>Currently the example implementation of the crawler component services is very simple. It's not really suitable for productive use, but it should suffice to demonstrate the concepts.
</p>
<ul><li> <tt>ObjectStoreVisitedLinksService</tt> (implements <tt>VisitedLinksService</tt>): Uses the <tt>ObjectStoreService</tt> to store which links have been visited, similar to the <tt><a href="../DeltaCheck.html#ObjectStoreDeltaService" title="SMILA/Documentation/Importing/DeltaCheck">ObjectStoreDeltaService</a></tt>. It uses a configuration file with the same properties in the same configuration directory, but named <tt>visitedlinksstore.properties</tt>.
</li><li> <tt>SimpleFetcher</tt>: Uses a GET request to read the URL. It does not follow redirects or do authentication or other advanced stuff. Write content to attachment <tt>http.content</tt>, if the resource is of mimetype <tt>text/html</tt> and set the following attributes:
<ul><li> <tt>http.size</tt>: value from HTTP header <tt>Content-Length</tt> (-1, if not set), as a Long value.
</li><li> <tt>http.contenttype</tt>: value from HTTP header <tt>Content-Type</tt>, if set.
</li><li> <tt>http.mimetype</tt>: mimetype part of HTTP header <tt>Content-Type</tt>, if set.
</li><li> <tt>http.charset</tt>: charset part of HTTP header <tt>Content-Type</tt>, if set.
</li><li> <tt>http.lastModified</tt>: value from HTTP header <tt>Last-Modified</tt>, if set, as a DateTime value.
</li></ul>
</li><li> <tt>SimpleRecordProducer</tt>: Set record source and calculates <tt>_deltaHash</tt> value for DeltaChecker worker (first wins):
<ul><li> if content is attached, calculate a digest.
</li><li> if <tt>http.lastModified</tt> attribute is set, use it as the hash.
</li><li> if <tt>http.size</tt> attribute is set, concatenate value of <tt>http.mimetype</tt> attribute and use it as hash
</li><li> if nothing works, create a UUID to force updating.
</li></ul>
</li><li> <tt>SimpleLinkExtractor</tt> (implements <tt>LinkExtractor</tt>: Simple link extraction from HTML <tt>&lt;A href="..."&gt;</tt> tags using the tagsoup HTML parser.
</li><li> <tt>SimpleLinkFilter</tt>: Removes fragment parts from URLs ("#..."), filter URLs with parameters ("?...") and remove duplicates (case sensitive). Filters also links to hosts other than in the link from which they were extracted (case-insensitive, but the complete host part of the URL must match). Additionally, if the <tt>filter-&gt;urlPrefix</tt> parameter is set, all links are removed that do not start with exactly the specified string.
</li></ul>
<a name="Web_Fetcher_Worker"></a><h3> <span class="mw-headline"> Web Fetcher Worker </span></h3>
<ul><li> Worker name: <tt>webFetcher</tt>
</li><li> Parameters: none
</li><li> Input slots:
<ul><li> <tt>linksToFetch</tt>: Records describing crawled resources, with or without the content of the resource.
</li></ul>
</li><li> Output slots:
<ul><li> <tt>fetchedLinks</tt>: The incoming records with the content of the resource attached.
</li></ul>
</li></ul>
<p>The fetcher tries to get the content of a web resource identified by attribute <tt>http.url</tt>, if attachment <tt>http.content</tt> is not yet set. Like the <tt>SimpleFetcher</tt> above it does not do redirects or authentication or other fancy stuff to read the resource, but just uses a simple <tt>GET</tt> request.
</p>
<!--
NewPP limit report
Preprocessor node count: 58/1000000
Post-expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
#ifexist count: 0/100
-->
<!-- Saved in parser cache with key wikidb:pcache:idhash:35060-0!1!0!!en!2!edit=0 and timestamp 20120202171436 -->
<div class="printfooter">
Retrieved from "<a href="Web.html">http://wiki.eclipse.org/SMILA/Documentation/Importing/Crawler/Web</a>"</div>
<!-- end content -->
<div class="visualClear"></div>
</div>
</div>
</div>
<!-- Yoink of toolbox for phoenix moved up -->
</div>
</div>
<div id="clearFooter"/>
<div id="footer" >
<ul id="footernav">
<li class="first"><a href="http://www.eclipse.org/">Home</a></li>
<li><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li>
<li><a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></li>
<li><a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a></li>
<li><a href="http://www.eclipse.org/org/foundation/contact.php">Contact</a></li>
<li><a href="http://wiki.eclipse.org/Eclipsepedia:About" title="Eclipsepedia:About">About Eclipsepedia</a></li>
</ul>
<span id="copyright">Copyright &copy; 2012 The Eclipse Foundation. All Rights Reserved</span>
<p id="footercredit">This page was last modified 10:08, 23 January 2012 by <a href="http://wiki.eclipse.org/User:Andreas.schank.attensity.com" title="User:Andreas.schank.attensity.com">A. Schank</a>. Based on work by <a href="http://wiki.eclipse.org/index.php?title=User:Juergen.schumacher.attensity.com&amp;action=edit" class="new" title="User:Juergen.schumacher.attensity.com">Juergen Schumacher</a>.</p>
<p id="footerviews">This page has been accessed 376 times.</p>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-910670-4");
pageTracker._trackPageview();
</script>
<!-- <div class="visualClear"></div> -->
<script type="text/javascript">if (window.runOnloadHook) runOnloadHook();</script>
</div>
<!-- Served in 0.060 secs. --></body></html>