WebLogParser { public static Map<String, Mapper> loadRegistry(Model model) { List<Resource> rs = model.listResourcesWithProperty(RDF.type, LSQ.WebAccessLogFormat).toList(); Map<String, Mapper> result = rs.stream() .filter(r -> r.hasProperty(LSQ.pattern)) .collect(Collectors.toMap( r -> r.getLocalName(), r -> create(r.getProperty(LSQ.pattern).getString()) )); return result; } WebLogParser(Pattern pattern, DateFormat dateFormat);  WebLogParser(PatternMatcher patternMatcher, DateFormat dateFormat); static Map<String, Mapper> loadRegistry(Model model); static Map<String, WebLogParser> getFormatRegistry(); static Mapper create(String pattern); static Map<String, BiConsumer<StringMapper, String>> createWebServerLogStringMapperConfig(); static String encodeUnsafeCharacters(String uri); boolean parseEntry(String str, Resource inout); static void extractQuery(Resource r); static String extractQueryString2(String uri); static String extractQueryString(String pathStr); static final String requestPattern; static String bio2rdfLogEntryPatternStr; static String virtuosoLogEntryPatternStr; static String distributedLogEntryPatternStr; static String apacheLogEntryPatternStr; static String requestParserStr; static final Pattern apacheLogEntryPattern; static final Pattern virtuosoLogEntryPattern; static final Pattern distributedLogEntryPattern; static final Pattern bio2rdfLogEntryPattern; static final Pattern requestParser; static final DateFormat apacheDateFormat; static final DateFormat virtuosoDateFormat; }
@Test public void testWebLogParserRoundtripApache() { Map<String, Mapper> logFmtRegistry = WebLogParser.loadRegistry(RDFDataMgr.loadModel("default-log-formats.ttl")); Mapper mapper = logFmtRegistry.get("combined"); Resource x = ModelFactory.createDefaultModel().createResource(); String expected = "140.203.154.206 - - [16/May/2014:00:29:09 +0100] \"GET http: mapper.parse(x, expected); RDFDataMgr.write(System.out, x.getModel(), RDFFormat.TURTLE); String actual = mapper.unparse(x); actual = actual.replaceAll("\\[[^]]*\\]", "[]"); expected = expected.replaceAll("\\[[^]]*\\]", "[]"); System.out.println(expected); System.out.println(actual); Assert.assertEquals(expected, actual); }