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

Fixed issue #9. Just added missing parameters as '' #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions examples/generate-samples/generate-samples.pig
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

/**
* Extracts from DBpedia sources the necessary data for the wikipedia sample.
* Designed to run on a cluster...
*
*/

-- Launch on cluster with: pig -p PIGNLPROC_JAR=../../target/pignlproc-0.1.0-SNAPSHOT.jar -p LANG=en -p RESOURCES_PATH=/wikipedia -p DEPENDENCIES=../../target/lib/*.jar generate-samples.pig

REGISTER $PIGNLPROC_JAR
REGISTER $DEPENDENCIES
%DECLARE WIKISAMPLE wiki-20090902-pages-articles-sample.xml
%DECLARE WIKIFILE $LANG$WIKISAMPLE
DEFINE extract_sentences pignlproc.evaluation.SentencesWithLink();

wikipedia_data = LOAD '$RESOURCES_PATH/$WIKIFILE'
USING pignlproc.storage.ParsingWikipediaLoader('$LANG')
AS (title, wikiuri, text, redirect, links, headers, paragraphs);

-- Load wikipedia, instance types and redirects from dbpedia dumps
dbpedia_wikipedia_links = LOAD '$RESOURCES_PATH/wikipedia_links_$LANG.nt'
USING pignlproc.storage.UriUriNTriplesLoader(
'http://xmlns.com/foaf/0.1/primaryTopic', '', '')
AS (wikiuri: chararray, dburi: chararray);

-- Get all useful dbpedia_wikipedia_links
wikipedia_data_wikiuris = FOREACH wikipedia_data GENERATE wikiuri ;
selected_dburis = JOIN dbpedia_wikipedia_links BY wikiuri, wikipedia_data_wikiuris BY wikiuri ;
dbpedia_wikipedia_links_RDF = FOREACH selected_dburis GENERATE dbpedia_wikipedia_links::wikiuri, dburi ;

STORE dbpedia_wikipedia_links_RDF INTO 'wikipedia_links_$LANG-sample.nt' USING pignlproc.storage.UriUriNTriplesStorer('http://xmlns.com/foaf/0.1/primaryTopic') ;


/*
--dbpedia_redirects = LOAD '$INPUT/redirects_$LANG.nt'
-- USING pignlproc.storage.UriUriNTriplesLoader(
-- 'http://dbpedia.org/ontology/wikiPageRedirects', '', '')
-- AS (source: chararray, target: chararray);

-- the last tuple can be (null, null)

--wikipedia_links_notnull =
-- FILTER wikipedia_links BY wikiuri IS NOT NULL;

-- follow the redirect links if any

--redirect_joined = JOIN wikipedia_links_notnull BY dburi LEFT OUTER, redirects BY source;
--redirected_wikipedia_links = FOREACH redirect_joined GENERATE
-- (target IS NOT NULL ? target : dburi) AS dburi, wikiuri;

-- Load dbpedia type data and filter out the overly generic owl:Thing type

--dbpedia_instance_types =
-- LOAD '$INPUT/instance_types_en.nt'
-- USING pignlproc.storage.UriUriNTriplesLoader(
-- 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', '', '')
-- AS (dburi: chararray, type: chararray);

--instance_types_no_thing =
-- FILTER instance_types BY type NEQ 'http://www.w3.org/2002/07/owl#Thing';

--joined = JOIN instance_types_no_thing BY dburi, redirected_wikipedia_links BY dburi;

*/


6 changes: 3 additions & 3 deletions examples/ner-corpus/02_dbpedia_article_types.pig
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ REGISTER $PIGNLPROC_JAR
-- Load wikipedia, instance types and redirects from dbpedia dumps
wikipedia_links = LOAD '$INPUT/wikipedia_links_$LANG.nt'
USING pignlproc.storage.UriUriNTriplesLoader(
'http://xmlns.com/foaf/0.1/primaryTopic')
'http://xmlns.com/foaf/0.1/primaryTopic', '', '')
AS (wikiuri: chararray, dburi: chararray);

redirects = LOAD '$INPUT/redirects_$LANG.nt'
USING pignlproc.storage.UriUriNTriplesLoader(
'http://dbpedia.org/ontology/wikiPageRedirects')
'http://dbpedia.org/ontology/wikiPageRedirects', '', '')
AS (source: chararray, target: chararray);

-- the last tuple can be (null, null)
Expand All @@ -28,7 +28,7 @@ redirected_wikipedia_links = FOREACH redirect_joined GENERATE
instance_types =
LOAD '$INPUT/instance_types_en.nt'
USING pignlproc.storage.UriUriNTriplesLoader(
'http://www.w3.org/1999/02/22-rdf-syntax-ns#type')
'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', '', '')
AS (dburi: chararray, type: chararray);

instance_types_no_thing =
Expand Down
21 changes: 21 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,27 @@
-->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>runtime</includeScope>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down