@Test public void testClassCount() { Model model = ModelFactory.createDefaultModel(); model.add(model.createResource("http: .resource()); Statistics statistics = new Statistics(); Map<String, Double> stats = statistics.getClassCounts(model); Assert.assertTrue(stats.containsKey(PdbOwlVocabulary.Class.StructureDetermination.uri())); Assert.assertEquals(1d, stats.get(PdbOwlVocabulary.Class.StructureDetermination.uri()), 0); }
public Map<String, Double> getClassCounts(Model model) { QueryExecution execution = QueryExecutionFactory .create("select ?c ?i where { ?i <" + RDF.type + "> ?c }", model); ResultSet result = execution.execSelect(); Map<String, Double> stats = new HashMap<String, Double>(); while (result.hasNext()) { QuerySolution solution = result.next(); String className = solution.getResource("c").getURI(); if (stats.containsKey(className)) { stats.put(className, stats.get(className) + 1); } else { stats.put(className, 1d); } } return stats; }
Statistics { public Map<String, Double> getClassCounts(Model model) { QueryExecution execution = QueryExecutionFactory .create("select ?c ?i where { ?i <" + RDF.type + "> ?c }", model); ResultSet result = execution.execSelect(); Map<String, Double> stats = new HashMap<String, Double>(); while (result.hasNext()) { QuerySolution solution = result.next(); String className = solution.getResource("c").getURI(); if (stats.containsKey(className)) { stats.put(className, stats.get(className) + 1); } else { stats.put(className, 1d); } } return stats; } }
Statistics { public Map<String, Double> getClassCounts(Model model) { QueryExecution execution = QueryExecutionFactory .create("select ?c ?i where { ?i <" + RDF.type + "> ?c }", model); ResultSet result = execution.execSelect(); Map<String, Double> stats = new HashMap<String, Double>(); while (result.hasNext()) { QuerySolution solution = result.next(); String className = solution.getResource("c").getURI(); if (stats.containsKey(className)) { stats.put(className, stats.get(className) + 1); } else { stats.put(className, 1d); } } return stats; }  }
Statistics { public Map<String, Double> getClassCounts(Model model) { QueryExecution execution = QueryExecutionFactory .create("select ?c ?i where { ?i <" + RDF.type + "> ?c }", model); ResultSet result = execution.execSelect(); Map<String, Double> stats = new HashMap<String, Double>(); while (result.hasNext()) { QuerySolution solution = result.next(); String className = solution.getResource("c").getURI(); if (stats.containsKey(className)) { stats.put(className, stats.get(className) + 1); } else { stats.put(className, 1d); } } return stats; }  Map<String, Double> getStatistics(Model model); Map<String, Double> getRelationshipCounts(Model model); Map<String, Double> getClassCounts(Model model); double getNumberOfTriples(Model model); String getRelationshipPair(String uri1, String uri2); Map<String, Double> mergeStats(Map<String, Double> source, Map<String, Double> target); }
Statistics { public Map<String, Double> getClassCounts(Model model) { QueryExecution execution = QueryExecutionFactory .create("select ?c ?i where { ?i <" + RDF.type + "> ?c }", model); ResultSet result = execution.execSelect(); Map<String, Double> stats = new HashMap<String, Double>(); while (result.hasNext()) { QuerySolution solution = result.next(); String className = solution.getResource("c").getURI(); if (stats.containsKey(className)) { stats.put(className, stats.get(className) + 1); } else { stats.put(className, 1d); } } return stats; }  Map<String, Double> getStatistics(Model model); Map<String, Double> getRelationshipCounts(Model model); Map<String, Double> getClassCounts(Model model); double getNumberOfTriples(Model model); String getRelationshipPair(String uri1, String uri2); Map<String, Double> mergeStats(Map<String, Double> source, Map<String, Double> target);  }