Skip to content

Commit fb8e74f

Browse files
committed
improves README and tries fixing testPDFLinks
1 parent 575f60d commit fb8e74f

4 files changed

Lines changed: 59 additions & 53 deletions

File tree

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### com.bitplan.simplegraph
22
[Wrapper for Apache TinkerPop](http://www.bitplan.com/index.php/SimpleGraph)
33

4-
[![Travis (.org)](https://img.shields.io/travis/BITPlan/com.bitplan.simplegraph.svg)](https://travis-ci.org/BITPlan/com.bitplan.simplegraph)
4+
[![Build Status](https://github.com/BITPlan/com.bitplan.simplegraph/actions/workflows/maven.yml/badge.svg)](https://github.com/BITPlan/com.bitplan.simplegraph/actions)
55
[![Maven Central](https://img.shields.io/maven-central/v/com.bitplan.simplegraph/com.bitplan.simplegraph.svg)](https://search.maven.org/artifact/com.bitplan.simplegraph/com.bitplan.simplegraph/0.1.0/jar)
66

77
[![GitHub issues](https://img.shields.io/github/issues/BITPlan/com.bitplan.simplegraph.svg)](https://github.com/BITPlan/com.bitplan.simplegraph/issues)
@@ -40,15 +40,15 @@ mvn install
4040
# available modules / Systems wrapped
4141
| Module | System wrapped | API exposed |
4242
|---------------------------------------------------------------------- | ---------------- | ----------- |
43-
|![CalDAV](https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Circle-icons-calendar.svg/100px-Circle-icons-calendar.svg.png)[CalDAV](http://www.bitplan.com/index.php/SimpleGraph-CalDAV) |[CalDAV](https://en.wikipedia.org/wiki/CalDAV) |[ical4j library for parsing and building iCalendar data models](https://github.com/ical4j/ical4j)
43+
|![CalDAV](https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Circle-icons-calendar.svg/100px-Circle-icons-calendar.svg.png)[CalDAV](http://www.bitplan.com/index.php/SimpleGraph-CalDAV) |[CalDAV](https://en.wikipedia.org/wiki/CalDAV) |[ical4j library for parsing and building iCalendar data models](https://github.com/ical4j/ical4j)
4444
|![Excel](https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Microsoft_Excel_2013_logo.svg/100px-Microsoft_Excel_2013_logo.svg.png)[Excel](http://www.bitplan.com/index.php/SimpleGraph-Excel) |[Excel](https://en.wikipedia.org/wiki/Microsoft_Excel) |[Apache POI XSSF/HSSF](https://poi.apache.org/spreadsheet/quick-guide.html)
4545
|![FileSystem](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/Folder.svg/100px-Folder.svg.png)[FileSystem](http://www.bitplan.com/index.php/SimpleGraph-FileSystem) |[FileSystem](https://en.wikipedia.org/wiki/File_system) |[java.io.File](https://docs.oracle.com/javase/8/docs/api/java/io/File.html)
46-
|![GeoJSON](https://upload.wikimedia.org/wikipedia/commons/thumb/5/55/SFA_Polygon_with_hole.svg/100px-SFA_Polygon_with_hole.svg.png)[GeoJSON](http://www.bitplan.com/index.php/SimpleGraph-GeoJSON) |[GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) |[GeoJSON support for Google gson library](https://github.com/filosganga/geogson)
47-
|![GitHub](http://wiki.bitplan.com/images/wiki/thumb/6/61/Octocat.png/100px-Octocat.png)[GitHub](http://www.bitplan.com/index.php/SimpleGraph-GitHub) |[GitHub](https://github.com) |[GitHub GraphQL API v4](https://developer.github.com/v4/)
46+
|![GeoJSON](https://upload.wikimedia.org/wikipedia/commons/thumb/5/55/SFA_Polygon_with_hole.svg/100px-SFA_Polygon_with_hole.svg.png)[GeoJSON](http://www.bitplan.com/index.php/SimpleGraph-GeoJSON) |[GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) |[GeoJSON support for Google gson library](https://github.com/filosganga/geogson)
47+
|![GitHub](http://wiki.bitplan.com/images/wiki/thumb/6/61/Octocat.png/100px-Octocat.png)[GitHub](http://www.bitplan.com/index.php/SimpleGraph-GitHub) |[GitHub](https://github.com) |[GitHub GraphQL API v4](https://developer.github.com/v4/)
4848
|![HTML](https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/HTML5_logo_and_wordmark.svg/100px-HTML5_logo_and_wordmark.svg.png)[HTML](http://www.bitplan.com/index.php/SimpleGraph-HTML) |[HTML](https://en.wikipedia.org/wiki/HTML) |[HTML Cleaner](http://htmlcleaner.sourceforge.net/)
49-
|![Java](http://wiki.bitplan.com/images/wiki/thumb/e/e1/Java-Logo.svg/100px-Java-Logo.svg.png)[Java](http://www.bitplan.com/index.php/SimpleGraph-Java) |[Java](https://en.wikipedia.org/wiki/Java_(programming_language)) |[javaparser](https://github.com/javaparser/javaparser)
49+
|![Java](http://wiki.bitplan.com/images/wiki/thumb/e/e1/Java-Logo.svg/100px-Java-Logo.svg.png)[Java](http://www.bitplan.com/index.php/SimpleGraph-Java) |[Java](https://en.wikipedia.org/wiki/Java_(programming_language)) |[javaparser](https://github.com/javaparser/javaparser)
5050
|![JSON](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/JSON_vector_logo.svg/100px-JSON_vector_logo.svg.png)[JSON](http://www.bitplan.com/index.php/SimpleGraph-JSON) |[JSON](https://en.wikipedia.org/wiki/JavaScript_Object_Notation) |[JSON](https://www.json.org/)
51-
![Mail](https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Email_Icon.svg/100px-Email_Icon.svg.png)[Mail](http://www.bitplan.com/index.php/SimpleGraph-Mail) |[Mail](https://en.wikipedia.org/wiki/MIME) |[E-Mail access for rfc822 and MIME formatted Mailbox files (e.g. Thunderbird)](https://james.apache.org/mime4j/)
51+
![Mail](https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Email_Icon.svg/100px-Email_Icon.svg.png)[Mail](http://www.bitplan.com/index.php/SimpleGraph-Mail) |[Mail](https://en.wikipedia.org/wiki/MIME) |[E-Mail access for rfc822 and MIME formatted Mailbox files (e.g. Thunderbird)](https://james.apache.org/mime4j/)
5252
|![MapSystem](http://wiki.bitplan.com/images/wiki/thumb/4/43/Map.png/100px-Map.png)[MapSystem](http://www.bitplan.com/index.php/SimpleGraph-MapSystem) |[MapSystem](https://en.wikipedia.org/wiki/Hash_table) |[java.api.Map](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html)
5353
|![MediaWiki](https://upload.wikimedia.org/wikipedia/commons/thumb/3/30/Mediawiki_logo_reworked.svg/100px-Mediawiki_logo_reworked.svg.png)[MediaWiki](http://www.bitplan.com/index.php/SimpleGraph-MediaWiki) |[MediaWiki](https://www.mediawiki.org/wiki/API:Main_page_MediaWiki) |[MediaWiki API](https://www.mediawiki.org/wiki/API:Main_page)
5454
|![PDF](https://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Pdf_by_mimooh.svg/100px-Pdf_by_mimooh.svg.png)[PDF](http://www.bitplan.com/index.php/SimpleGraph-PDF) |[PDF](https://de.wikipedia.org/wiki/Portable_Document_Format) |[Apache PDFBox](https://pdfbox.apache.org/)
@@ -58,8 +58,8 @@ mvn install
5858
|![SQL](http://wiki.bitplan.com/images/wiki/thumb/1/18/Database.svg/100px-Database.svg.png)[SQL](http://www.bitplan.com/index.php/SimpleGraph-SQL) |[SQL](https://en.wikipedia.org/wiki/SQL) |[Java Database Connectivity (JDBC) API](https://docs.oracle.com/javase/8/docs/api/java/sql/package-summary.html)
5959
|![TripleStore](http://wiki.bitplan.com/images/wiki/thumb/5/52/TripleStore-Icon.png/100px-TripleStore-Icon.png)[TripleStore](http://www.bitplan.com/index.php/SimpleGraph-TripleStore) |[TripleStore](https://en.wikipedia.org/wiki/Triplestore) |[SiDIF-TripleStore](https://github.com/BITPlan/org.sidif.triplestore)
6060
|![WikiData](https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/Wikidata-logo-en.svg/100px-Wikidata-logo-en.svg.png)[WikiData](http://www.bitplan.com/index.php/SimpleGraph-WikiData) |[WikiData](https://en.wikipedia.org/wiki/Wikidata) |[WikiData Toolkit](https://github.com/Wikidata/Wikidata-Toolkit)
61-
|![Word](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Microsoft_Word_2013_logo.svg/100px-Microsoft_Word_2013_logo.svg.png)[Word](http://www.bitplan.com/index.php/SimpleGraph-Word) |[Word](https://en.wikipedia.org/wiki/Word) |[Apache POI XWPF/HWPF](https://poi.apache.org/document/quick-guide-xwpf.html)
62-
|![XML](https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/Xml_logo.svg/150px-Xml_logo.svg.png)[XML](http://www.bitplan.com/index.php/SimpleGraph-XML) |[XML](https://en.wikipedia.org/wiki/XML) |[org.w3c.dom](https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/package-summary.html)
61+
|![Word](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Microsoft_Word_2013_logo.svg/100px-Microsoft_Word_2013_logo.svg.png)[Word](http://www.bitplan.com/index.php/SimpleGraph-Word) |[Word](https://en.wikipedia.org/wiki/Word) |[Apache POI XWPF/HWPF](https://poi.apache.org/document/quick-guide-xwpf.html)
62+
|![XML](https://upload.wikimedia.org/wikipedia/commons/thumb/9/9d/Xml_logo.svg/150px-Xml_logo.svg.png)[XML](http://www.bitplan.com/index.php/SimpleGraph-XML) |[XML](https://en.wikipedia.org/wiki/XML) |[org.w3c.dom](https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/package-summary.html)
6363

6464
# Documentation
6565
* http://www.bitplan.com/index.php/SimpleGraph
@@ -84,3 +84,5 @@ mvn install
8484
| 0.0.3 | 2018-12-07 | maven release 0.0.3
8585
| 0.0.4 | 2019-02-12 | fixes #28 and releases 0.0.4
8686
| 0.0.5 | 2019-03-23 | fixes #26 and releases 0.0.5
87+
| 0.0.6 | 2025-04-19 | internal release
88+
| 0.1.0 | 2025-12-30 | Java 21 version

docs/history.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@
1111
| 0.0.3 | 2018-12-07 | maven release 0.0.3
1212
| 0.0.4 | 2019-02-12 | fixes #28 and releases 0.0.4
1313
| 0.0.5 | 2019-03-23 | fixes #26 and releases 0.0.5
14+
| 0.0.6 | 2025-04-19 | internal release
15+
| 0.1.0 | 2025-12-30 | Java 21 version

simplegraph-html/src/test/java/com/bitplan/simplegraph/html/TestHtmlSystem.java

Lines changed: 47 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
package com.bitplan.simplegraph.html;
2222

2323
import static org.junit.Assert.assertEquals;
24+
import static org.junit.Assert.assertTrue;
2425

2526
import java.util.logging.Logger;
27+
import java.util.regex.Pattern;
2628

2729
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
2830
import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -38,46 +40,52 @@
3840
*
3941
*/
4042
public class TestHtmlSystem {
41-
public static boolean debug = false;
42-
protected static Logger LOGGER = Logger
43-
.getLogger("com.bitplan.simplegraph.html");
43+
public static boolean debug = false;
44+
protected static Logger LOGGER = Logger.getLogger("com.bitplan.simplegraph.html");
4445

45-
@Test
46-
public void testRootNodeAttributes() throws Exception {
47-
HtmlSystem hs = HtmlSystem.forUrl("http://agilemanifesto.org/");
48-
HtmlNode htmlNode = (HtmlNode) hs.getStartNode();
49-
assertEquals("html", htmlNode.getRootNode().getName());
50-
// debug = true;
51-
if (debug) {
52-
htmlNode.forAll(SimpleNode.printDebug);
53-
}
54-
GraphTraversal<Vertex, Vertex> links = hs.g().V().hasLabel("a");
55-
assertEquals(72, links.count().next().longValue());
56-
links = hs.g().V().hasLabel("a");
57-
if (debug)
58-
links.forEachRemaining(
59-
link -> System.out.println(link.property("href").value()));
60-
// links.forEach(link -> System.out.println(link));
61-
// links.entrySet().forEach(entry->System.out.println(entry.getKey()+"="+entry.getValue()));
62-
}
46+
@Test
47+
public void testRootNodeAttributes() throws Exception {
48+
HtmlSystem hs = HtmlSystem.forUrl("http://agilemanifesto.org/");
49+
HtmlNode htmlNode = (HtmlNode) hs.getStartNode();
50+
assertEquals("html", htmlNode.getRootNode().getName());
51+
// debug = true;
52+
if (debug) {
53+
htmlNode.forAll(SimpleNode.printDebug);
54+
}
55+
GraphTraversal<Vertex, Vertex> links = hs.g().V().hasLabel("a");
56+
assertEquals(72, links.count().next().longValue());
57+
links = hs.g().V().hasLabel("a");
58+
if (debug)
59+
links.forEachRemaining(link -> System.out.println(link.property("href").value()));
60+
// links.forEach(link -> System.out.println(link));
61+
// links.entrySet().forEach(entry->System.out.println(entry.getKey()+"="+entry.getValue()));
62+
}
6363

64-
@Test
65-
public void testPDFLinks() throws Exception {
66-
HtmlSystem hs = HtmlSystem.forUrl(
67-
"https://filesamples.com/formats/pdf");
68-
int expectedCount=3;
69-
HtmlNode htmlNode = (HtmlNode) hs.getStartNode();
70-
assertEquals("html", htmlNode.getRootNode().getName());
71-
// debug = true;
72-
if (debug) {
73-
htmlNode.forAll(SimpleNode.printDebug);
74-
}
75-
GraphTraversal<Vertex, Vertex> links = hs.g().V().hasLabel("a").has("href",
76-
RegexPredicate.regex(".*pdf"));
77-
assertEquals(expectedCount, links.count().next().longValue());
78-
links = hs.g().V().hasLabel("a").has("href", RegexPredicate.regex(".*pdf"));
79-
links.forEachRemaining(
80-
link -> System.out.println(link.property("href").value()));
81-
}
64+
@Test
65+
public void testPDFLinks() throws Exception {
66+
HtmlSystem hs = HtmlSystem.forUrl("https://www.princexml.com/samples/");
67+
int expectedCount = 23;
68+
HtmlNode htmlNode = (HtmlNode) hs.getStartNode();
69+
assertEquals("html", htmlNode.getRootNode().getName());
70+
// debug = true;
71+
if (debug) {
72+
htmlNode.forAll(SimpleNode.printDebug);
73+
}
74+
GraphTraversal<Vertex, Vertex> links = hs.g().V().hasLabel("a").has("href", RegexPredicate.regex(".*pdf"));
75+
assertEquals(expectedCount, links.count().next().longValue());
76+
links = hs.g().V().hasLabel("a").has("href", RegexPredicate.regex(".*pdf"));
77+
78+
Pattern pdfPattern = Pattern.compile("^/samples/.*\\.pdf$");
79+
80+
links.forEachRemaining(link -> {
81+
String hrefValue = link.property("href").value().toString();
82+
boolean isValid = pdfPattern.matcher(hrefValue).matches();
83+
if (debug) {
84+
System.out.println(hrefValue + (isValid ? " ✓" : " ✗ INVALID"));
85+
}
86+
87+
assertTrue("Invalid PDF href pattern: " + hrefValue, isValid);
88+
});
89+
}
8290

8391
}

0 commit comments

Comments
 (0)