From: <lor...@us...> - 2013-09-04 09:56:48
|
Revision: 4054 http://sourceforge.net/p/dl-learner/code/4054 Author: lorenz_b Date: 2013-09-04 09:56:41 +0000 (Wed, 04 Sep 2013) Log Message: ----------- Added simple stop word filtering list. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/qtl/operations/lgg/LGGGeneratorImpl.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java Added Paths: ----------- trunk/components-core/src/main/resources/stopwords.txt Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/qtl/operations/lgg/LGGGeneratorImpl.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/qtl/operations/lgg/LGGGeneratorImpl.java 2013-09-04 09:55:35 UTC (rev 4053) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/qtl/operations/lgg/LGGGeneratorImpl.java 2013-09-04 09:56:41 UTC (rev 4054) @@ -26,10 +26,16 @@ import java.util.TreeSet; import org.apache.log4j.Logger; +import org.dllearner.algorithms.qtl.cache.QueryTreeCache; import org.dllearner.algorithms.qtl.datastructures.QueryTree; import org.dllearner.algorithms.qtl.datastructures.impl.QueryTreeImpl; +import org.dllearner.kb.sparql.ConciseBoundedDescriptionGenerator; +import org.dllearner.kb.sparql.ConciseBoundedDescriptionGeneratorImpl; +import org.dllearner.kb.sparql.SparqlEndpoint; +import com.google.common.collect.Lists; import com.hp.hpl.jena.datatypes.RDFDatatype; +import com.hp.hpl.jena.rdf.model.Model; import com.jamonapi.Monitor; import com.jamonapi.MonitorFactory; @@ -112,7 +118,7 @@ return lgg; } - private QueryTree<N> computeLGG(QueryTree<N> tree1, QueryTree<N> tree2, boolean learnFilters){ + private QueryTree<N> computeLGG(QueryTree<N> tree1, QueryTree<N> tree2, boolean learnFilters){System.out.println("call"); if(logger.isDebugEnabled()){ logger.debug("Computing LGG for"); logger.debug(tree1.getStringRepresentation()); @@ -222,5 +228,30 @@ addNumbering(child); } } + + public static void main(String[] args) throws Exception { + LGGGenerator<String> lggGen = new LGGGeneratorImpl<String>(); + + List<QueryTree<String>> trees = new ArrayList<QueryTree<String>>(); + QueryTree<String> tree; + Model model; + ConciseBoundedDescriptionGenerator cbdGenerator = new ConciseBoundedDescriptionGeneratorImpl(SparqlEndpoint.getEndpointDBpedia(), "cache"); + cbdGenerator.setRecursionDepth(1); + QueryTreeCache treeCache = new QueryTreeCache(); + List<String> resources = Lists.newArrayList("http://dbpedia.org/resource/Leipzig");//, "http://dbpedia.org/resource/Dresden"); + for(String resource : resources){ + try { + System.out.println(resource); + model = cbdGenerator.getConciseBoundedDescription(resource); + tree = treeCache.getQueryTree(resource, model); + System.out.println(tree.getStringRepresentation()); + trees.add(tree); + trees.add(tree); + } catch (Exception e) { + e.printStackTrace(); + } + } + lggGen.getLGG(trees); + } } Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java 2013-09-04 09:55:35 UTC (rev 4053) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlEndpoint.java 2013-09-04 09:56:41 UTC (rev 4054) @@ -227,6 +227,18 @@ return new SparqlEndpoint(u, defaultGraphURIs, new LinkedList<String>()); } + public static SparqlEndpoint getEndpointDBpediaLOD2Cloud() { + URL u = null; + try { + u = new URL("http://lod.openlinksw.com/sparql/"); + } catch (Exception e) { + e.printStackTrace(); + } + LinkedList<String> defaultGraphURIs=new LinkedList<String>(); + defaultGraphURIs.add("http://dbpedia.org"); + return new SparqlEndpoint(u, defaultGraphURIs, new LinkedList<String>()); + } + public static SparqlEndpoint getEndpointLinkedGeoData() { URL u = null; try { Added: trunk/components-core/src/main/resources/stopwords.txt =================================================================== --- trunk/components-core/src/main/resources/stopwords.txt (rev 0) +++ trunk/components-core/src/main/resources/stopwords.txt 2013-09-04 09:56:41 UTC (rev 4054) @@ -0,0 +1,174 @@ +a +about +above +after +again +against +all +am +an +and +any +are +aren't +as +at +be +because +been +before +being +below +between +both +but +by +can't +cannot +could +couldn't +did +didn't +do +does +doesn't +doing +don't +down +during +each +few +for +from +further +had +hadn't +has +hasn't +have +haven't +having +he +he'd +he'll +he's +her +here +here's +hers +herself +him +himself +his +how +how's +i +i'd +i'll +i'm +i've +if +in +into +is +isn't +it +it's +its +itself +let's +me +more +most +mustn't +my +myself +no +nor +not +of +off +on +once +only +or +other +ought +our +ours +ourselves +out +over +own +same +shan't +she +she'd +she'll +she's +should +shouldn't +so +some +such +than +that +that's +the +their +theirs +them +themselves +then +there +there's +these +they +they'd +they'll +they're +they've +this +those +through +to +too +under +until +up +very +was +wasn't +we +we'd +we'll +we're +we've +were +weren't +what +what's +when +when's +where +where's +which +while +who +who's +whom +why +why's +with +won't +would +wouldn't +you +you'd +you'll +you're +you've +your +yours +yourself +yourselves \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |