예제 #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 void checkType(Resource root, Resource type) {
   if (!root.hasProperty(RDF.type, type))
     throw new CannotConstructException(this.getClass(), root, type);
 }
예제 #3
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);
 }