예제 #1
0
  private List<OntResource> listUnionMembers(OntProperty p, OntResource domain) {
    List<OntResource> list = new ArrayList<OntResource>();
    Resource union = domain.getPropertyResourceValue(OWL.unionOf);
    if (union != null && union.canAs(RDFList.class)) {

      RDFList rdfList = union.as(RDFList.class);
      Iterator<RDFNode> sequence = rdfList.iterator();
      while (sequence.hasNext()) {
        list.add(sequence.next().as(OntResource.class));
      }
    }
    return list;
  }
예제 #2
0
파일: Spec.java 프로젝트: mmmmmrob/Vertere
 public int[] getSourceColumns(Resource resource) {
   if (_model.contains(resource, Vertere.source_column)) {
     Statement sourceColumn = _model.getProperty(resource, Vertere.source_column);
     return new int[] {sourceColumn.getInt()};
   } else if (_model.contains(resource, Vertere.source_columns)) {
     Statement sourceColumns = _model.getProperty(resource, Vertere.source_columns);
     Resource listResource = sourceColumns.getResource();
     RDFList list = listResource.as(RDFList.class);
     List<RDFNode> javalist = list.asJavaList();
     int[] sourceColumnNumbers = new int[javalist.size()];
     for (int i = 0; i < javalist.size(); i++) {
       RDFNode node = javalist.get(i);
       Literal value = node.asLiteral();
       sourceColumnNumbers[i] = value.getInt();
     }
     return sourceColumnNumbers;
   } else {
     return new int[0];
   }
 }