TIKA-4831: Add content-based detection and a parser for GeoGebra files (ggb, ggs, ggt) - #3044
Open
dschmidt wants to merge 2 commits into
Open
TIKA-4831: Add content-based detection and a parser for GeoGebra files (ggb, ggs, ggt)#3044dschmidt wants to merge 2 commits into
dschmidt wants to merge 2 commits into
Conversation
Mark application/vnd.geogebra.file and .tool as sub-classes of application/zip so the filename hint survives magic detection, and add the (IANA-registered) application/vnd.geogebra.slides (*.ggs) and application/vnd.geogebra.pinboard (*.ggp) types. Add a GeoGebraDetector to the zip container detectors that recognizes the formats without a filename by their well-known entries: geogebra.xml (worksheet), structure.json plus _slideN/geogebra.xml (Notes/Slides) and geogebra_macro.xml (tool), in ZipFile and streaming mode. Keep ZipParser.ZIP_SPECIALIZATIONS in sync with the new registry entries.
Parse geogebra.xml/geogebra_macro.xml with the pooled, hardened SAX path: construction title/author/date and the app name/version/format/id become metadata, and the user-visible text (string-literal expressions, rich-text content runs, captions, macro names and help texts) is emitted as XHTML paragraphs. Notes/Slides files emit one div per slide in structure.json order and set xmpTPg:NPages. The representative rendering - geogebra_thumbnail.png at the root, or the first slide's thumbnail - is emitted as an embedded document marked embeddedResourceType=THUMBNAIL so unpack sidecars identify the preview image; other slides' thumbnails are redundant renderings and are skipped. Any other embedded file (e.g. inserted pictures) is emitted as an embedded document.
dschmidt
force-pushed
the
feat/geogebra
branch
from
August 21, 2026 18:39
0575303 to
882b69a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds detection and parsing support for the GeoGebra file formats.
Issue: https://issues.apache.org/jira/browse/TIKA-4831
Detection
application/vnd.geogebra.file(*.ggb) andapplication/vnd.geogebra.tool(*.ggt) are nowsub-class-of application/zip, so the filename hint survives magic detection instead of being discarded in favor of plainapplication/zipapplication/vnd.geogebra.slides(*.ggs, zip-based) andapplication/vnd.geogebra.pinboard(*.ggp, JSON-based)GeoGebraDetector(zip container detector, ZipFile and streaming mode) recognizes the formats without a filename by their well-known entries:geogebra.xml(worksheet),structure.json+_slideN/geogebra.xml(Notes/Slides),geogebra_macro.xml(tool). Since a worksheet with macros contains bothgeogebra.xmlandgeogebra_macro.xml, the decision is made after all entry names have been seenZipParser.ZIP_SPECIALIZATIONSis kept in sync with the new registry entriesParser
A new
GeoGebraParser(miscoffice module) forggb/ggs/ggt:dc:title/dc:creator/geogebra:date, plusgeogebra:appName,geogebra:appVersion,geogebra:formatVersion,geogebra:id; Notes/Slides setxmpTPg:NPagesstructure.jsonordergeogebra_thumbnail.pngat the root, or the first slide's thumbnail) is emitted as an embedded document markedembeddedResourceType=THUMBNAIL, following the existing convention in the OOXML, ODF and iWork parsers, so/unpack/allsidecars identify the preview image; other slides' thumbnails are redundant renderings and are skippedXML is parsed through
XMLReaderUtils.parseSAXlike the other parsers in the module;structure.jsonand rich-text runs use Jackson (newjackson-databinddependency in the miscoffice module, version managed by the existing BOM import).Testing
GeoGebraDetectionTest(zip-commons) andGeoGebraParserTest(miscoffice) with craftedggb/ggs/ggtfixtures; the ggs fixture deliberately orders_slide1before_slide0instructure.jsonto pin the ordering behaviortika-core,tika-parser-zip-commons,tika-parser-miscoffice-moduleandtika-parser-pkg-modulepass, plusCompositeZipContainerDetectorTestin the integration testsvnd.geogebra.slides, text extracted, thumbnail emitted with theTHUMBNAILmarker