@Test public void parsesFullConfigFile() throws Exception { File configFile = getResourceFile("/config/sample-config-full.xml"); Config config = ConfigReader.parseConfigXml(configFile); Map<String, String> expectedPrefixes = ImmutableMap.<String, String>builder() .put("rdf", "http: .put("rdfs", "http: .put("xsd", "http: .put("owl", "http: .put("odcs", "http: .put("fb", "http: .put("pc", "http: .build(); assertThat(config.getPrefixes(), equalTo(expectedPrefixes)); assertThat(config.getDataSources().size(), equalTo(3)); assertThat(config.getDataSources().get(0).getName(), equalTo("virtuoso_local")); assertThat(config.getDataSources().get(0).getType(), equalTo(EnumDataSourceType.VIRTUOSO)); assertThat(config.getDataSources().get(0).getParams().get(ConfigParameters.DATA_SOURCE_VIRTUOSO_HOST), equalTo("localhost")); assertThat(config.getDataSources().get(0).getParams().get(ConfigParameters.DATA_SOURCE_VIRTUOSO_PORT), equalTo("1111")); assertThat(config.getDataSources().get(0).getParams().get(ConfigParameters.DATA_SOURCE_VIRTUOSO_USERNAME), equalTo("dba")); assertThat(config.getDataSources().get(0).getParams().get(ConfigParameters.DATA_SOURCE_VIRTUOSO_PASSWORD), equalTo("dba")); assertThat(config.getDataSources().get(0).getNamedGraphRestriction().getPattern(), equalTo( "{ SELECT ?g WHERE {?g odcs:metadataGraph ?m} }\n" + " UNION { SELECT ?g WHERE {?a odcs:attachedGraph ?g} }" )); assertThat(config.getDataSources().get(0).getNamedGraphRestriction().getVar(), equalTo("g")); assertThat(config.getDataSources().get(1).getName(), nullValue()); assertThat(config.getDataSources().get(1).getType(), equalTo(EnumDataSourceType.SPARQL)); assertThat(config.getDataSources().get(1).getParams().get(ConfigParameters.DATA_SOURCE_SPARQL_ENDPOINT), equalTo("http: assertThat(config.getDataSources().get(1).getParams().get(ConfigParameters.DATA_SOURCE_SPARQL_MIN_QUERY_INTERVAL), equalTo("1000")); assertThat(config.getDataSources().get(1).getNamedGraphRestriction().getPattern(), equalTo("")); assertThat(config.getDataSources().get(2).getType(), equalTo(EnumDataSourceType.FILE)); assertThat(config.getDataSources().get(2).getName(), nullValue()); assertThat(config.getDataSources().get(2).getParams().get(ConfigParameters.DATA_SOURCE_FILE_PATH), equalTo("data.rdf")); assertThat(config.getDataSources().get(2).getParams().get(ConfigParameters.DATA_SOURCE_FILE_BASE_URI), equalTo("http: assertThat(config.getDataSources().get(2).getParams().get(ConfigParameters.DATA_SOURCE_FILE_FORMAT), equalTo("ntriples")); assertThat(config.getDataSources().get(2).getNamedGraphRestriction().getPattern(), equalTo("")); assertThat(config.getMetadataSources().size(), equalTo(1)); assertThat(config.getMetadataSources().get(0).getType(), equalTo(EnumDataSourceType.SPARQL)); assertThat(config.getMetadataSources().get(0).getName(), equalTo("metadata-local")); assertThat(config.getMetadataSources().get(0).getParams().get(ConfigParameters.DATA_SOURCE_SPARQL_ENDPOINT), equalTo("http: assertThat(config.getMetadataSources().get(0).getConstructQuery().trim(), equalTo("CONSTRUCT {?g odcs:score ?s } WHERE { ?g odcs:score ?s }")); assertThat(config.getSameAsSources().size(), equalTo(1)); assertThat(config.getSameAsSources().get(0).getType(), equalTo(EnumDataSourceType.SPARQL)); assertThat(config.getSameAsSources().get(0).getName(), equalTo("sameAs-local")); assertThat(config.getSameAsSources().get(0).getParams().get(ConfigParameters.DATA_SOURCE_SPARQL_ENDPOINT), equalTo("http: assertThat(config.getSameAsSources().get(0).getConstructQuery().trim(), equalTo("CONSTRUCT {?s owl:sameAs ?o} WHERE { ?s owl:sameAs ?o }")); assertThat(config.getCanonicalURIsInputFile(), equalTo(new File("output/canonicalUris.txt"))); assertThat(config.getCanonicalURIsOutputFile(), equalTo(new File("output/canonicalUris2.txt"))); assertThat(config.getMaxOutputTriples(), equalTo(999l)); assertThat(config.getEnableFileCache(), equalTo(true)); assertThat(config.isLocalCopyProcessing(), equalTo(true)); assertThat(config.getRequiredClassOfProcessedResources(), equalTo((URI) new URIImpl("http: assertThat(config.getDefaultResolutionStrategy(), notNullValue()); assertThat(config.getDefaultResolutionStrategy().getResolutionFunctionName(), equalTo("ALL")); assertThat(config.getDefaultResolutionStrategy().getAggregationErrorStrategy(), equalTo(EnumAggregationErrorStrategy.RETURN_ALL)); assertThat(config.getDefaultResolutionStrategy().getCardinality(), equalTo(EnumCardinality.MANYVALUED)); assertThat(config.getPropertyResolutionStrategies().size(), equalTo(3)); assertThat(config.getPropertyResolutionStrategies().get(RDFS.LABEL).getResolutionFunctionName(), equalTo("BEST")); assertThat(config.getPropertyResolutionStrategies().get(RDFS.LABEL).getDependsOn(), nullValue()); assertThat(config.getPropertyResolutionStrategies().get(RDFS.LABEL).getParams(), equalTo((Map<String, String>) ImmutableMap.of("name", "value"))); assertThat(config.getPropertyResolutionStrategies().get(FB_LONGITUDE).getResolutionFunctionName(), equalTo("AVG")); assertThat(config.getPropertyResolutionStrategies().get(FB_LONGITUDE).getDependsOn(), equalTo(FB_LATITUDE)); assertThat(config.getPropertyResolutionStrategies().get(FB_LATITUDE).getResolutionFunctionName(), equalTo("AVG")); assertThat(config.getPropertyResolutionStrategies().get(FB_LATITUDE).getParams(), equalTo((Map<String, String>) ImmutableMap.<String, String>of())); assertThat(config.getPropertyResolutionStrategies().get(FB_LATITUDE).getDependsOn(), equalTo(FB_LATITUDE)); assertThat(config.getOutputs().size(), equalTo(3)); assertThat(config.getOutputs().get(0).getName(), equalTo("n3-output")); assertThat(config.getOutputs().get(0).getType(), equalTo(EnumOutputType.FILE)); assertThat(config.getOutputs().get(0).getMetadataContext(), equalTo((URI) new URIImpl("http: assertThat(config.getOutputs().get(0).getDataContext(), equalTo((URI) new URIImpl("http: assertThat(config.getOutputs().get(0).getParams().size(), equalTo(6)); assertThat(config.getOutputs().get(1).getName(), equalTo("virtuoso-output")); assertThat(config.getOutputs().get(1).getType(), equalTo(EnumOutputType.VIRTUOSO)); assertThat(config.getOutputs().get(1).getMetadataContext(), nullValue()); assertThat(config.getOutputs().get(1).getDataContext(), equalTo((URI) new URIImpl("http: assertThat(config.getOutputs().get(1).getParams().size(), equalTo(5)); assertThat(config.getOutputs().get(2).getName(), equalTo("sparql-output")); assertThat(config.getOutputs().get(2).getType(), equalTo(EnumOutputType.SPARQL)); assertThat(config.getOutputs().get(2).getMetadataContext(), nullValue()); assertThat(config.getOutputs().get(2).getDataContext(), equalTo((URI) new URIImpl("http: assertThat(config.getOutputs().get(2).getParams().size(), equalTo(4)); assertThat(config.getMaxDateDifference(), equalTo(LDFTConfigConstants.MAX_DATE_DIFFERENCE)); assertThat(config.getOutputMappedSubjectsOnly(), equalTo(false)); assertThat(config.getPreferredCanonicalURIs(), equalTo(LDFTConfigConstants.DEFAULT_PREFERRED_CANONICAL_URIS)); assertThat(config.getTempDirectory(), equalTo(LDFTConfigConstants.DEFAULT_TEMP_DIRECTORY)); assertThat(config.getResultDataURIPrefix(), notNullValue()); assertThat(config.getPublisherScoreWeight(), equalTo(LDFTConfigConstants.PUBLISHER_SCORE_WEIGHT)); assertThat(config.getAgreeCoefficient(), equalTo(LDFTConfigConstants.AGREE_COEFFICIENT)); assertThat(config.getQueryTimeout(), equalTo(LDFTConfigConstants.DEFAULT_QUERY_TIMEOUT)); assertThat(config.getScoreIfUnknown(), equalTo(LDFTConfigConstants.SCORE_IF_UNKNOWN)); assertThat(config.isProfilingOn(), equalTo(false)); assertThat(config.getMaxFreeMemoryUsage(), equalTo(LDFTConfigConstants.MAX_FREE_MEMORY_USAGE)); assertThat(config.getMemoryLimit(), equalTo(null)); assertThat(config.getParserConfig(), equalTo(LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG)); assertThat(config.getSameAsLinkTypes(), is(LDFTConfigConstants.SAME_AS_LINK_TYPES)); }
public static Config parseConfigXml(File configFile) throws InvalidInputException { ConfigReader instance = new ConfigReader(); return instance.parseConfigXmlImpl(configFile); }
ConfigReader { public static Config parseConfigXml(File configFile) throws InvalidInputException { ConfigReader instance = new ConfigReader(); return instance.parseConfigXmlImpl(configFile); } }
ConfigReader { public static Config parseConfigXml(File configFile) throws InvalidInputException { ConfigReader instance = new ConfigReader(); return instance.parseConfigXmlImpl(configFile); } private  ConfigReader(); }
ConfigReader { public static Config parseConfigXml(File configFile) throws InvalidInputException { ConfigReader instance = new ConfigReader(); return instance.parseConfigXmlImpl(configFile); } private  ConfigReader(); static Config parseConfigXml(File configFile); }
ConfigReader { public static Config parseConfigXml(File configFile) throws InvalidInputException { ConfigReader instance = new ConfigReader(); return instance.parseConfigXmlImpl(configFile); } private  ConfigReader(); static Config parseConfigXml(File configFile);  }