コード例 #1
0
 protected static RDFNode getUnique(Resource root, Property property) {
   List<RDFNode> nodes = root.listProperties(property).mapWith(getObject).toList();
   if (nodes.size() == 0) return null;
   if (nodes.size() == 1) return nodes.get(0);
   throw new NotUniqueException(root, property);
 }
コード例 #2
0
 protected static Statement getUniqueStatement(Resource root, Property property) {
   List<Statement> statements = root.listProperties(property).toList();
   if (statements.size() == 0) return null;
   if (statements.size() == 1) return statements.get(0);
   throw new NotUniqueException(root, property);
 }