Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.ResIterator


  }
 
  public void printLinealNumericTransformers(Model model) throws Exception {
    Resource linealNumericTransformer = ResourceFactory.
        createResource(riNamespace + "LinealNumericTransformer");
    ResIterator iters = model.listSubjectsWithProperty(
        RDF.type,linealNumericTransformer);
    if (iters.hasNext()) {
        System.out.println("The database contains subjects" +
            " of type LinealNumericTransformer:");
        while (iters.hasNext()) {
            Resource resource = iters.nextResource();
            System.out.println("  " + resource.getLocalName());
            LinealNumericTransformer linNumInstance =
              getLinealNumericTransformer(model,resource);
            System.out.println(linNumInstance.toReducedString("     "));
        }
View Full Code Here


  }
 
  public void printLogaritmicNumericTransformers(Model model) throws Exception {
    Resource logaritmicNumericTransformer = ResourceFactory.
        createResource(riNamespace + "LogaritmicNumericTransformer");
    ResIterator iters = model.listSubjectsWithProperty(
        RDF.type,logaritmicNumericTransformer);
    if (iters.hasNext()) {
        System.out.println("The database contains subjects" +
            " of type LogaritmicNumericTransformer:");
        while (iters.hasNext()) {
            Resource resource = iters.nextResource();
            System.out.println("  " + resource.getLocalName());
            LogaritmicNumericTransformer logNumInstance =
              getLogaritmicNumericTransformer(model,resource);
            System.out.println("     sourceMetric:" +
                logNumInstance.getSourceMetric());
View Full Code Here

  }
 
  public void printScaleCorrelations(Model model) throws Exception {
    Resource scaleCorrelation = ResourceFactory.
        createResource(riNamespace + "ScaleCorrelation");
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,scaleCorrelation);
    if (iters.hasNext()) {
        System.out.println("The database contains subjects of type scaleCorrelation:");
        while (iters.hasNext()) {
            Resource resource = iters.nextResource();
            System.out.println("  " + resource.getLocalName());
            ScaleCorrelation scaCorInstance = getScaleCorrelation(model,resource);           
            System.out.println(scaCorInstance.toString("     "));
        }
    } else {
View Full Code Here

 
 
  public void printDimensionCorrelations(Model model) throws Exception {
    Resource dimensionCorrelation = ResourceFactory.
        createResource(riNamespace + "DimensionCorrelation");
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,dimensionCorrelation);
    if (iters.hasNext()) {
        System.out.println("The database contains subjects of type dimensionCorrelation:");
        while (iters.hasNext()) {
            Resource resource = iters.nextResource();
            System.out.println("  " + resource.getLocalName());
            DimensionCorrelation dimCorInstance = getDimensionCorrelation(model,resource);
            System.out.println(dimCorInstance.toString("     "));
        }
    } else {
View Full Code Here

  }
 
  public void printTrustBetweenCommunities(Model model) throws Exception {
    Resource trustBetweenCommunities = ResourceFactory.
        createResource(riNamespace + "TrustBetweenCommunities");   
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,trustBetweenCommunities);
    if (iters.hasNext()) {
        System.out.println("The database contains subjects of type TrustBetweenCommunities:");
        while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                TrustBetweenCommunities truBetInstance = null;
               
                /* boolean isASubclass = false;
                Resource fixedCommunitiesTrust = ResourceFactory.
View Full Code Here

  }
 
  public void printFixedCommunitiesTrust(Model model) throws Exception {
    Resource fixedCommunitiesTrust = ResourceFactory.
        createResource(riNamespace + "FixedCommunitiesTrust");
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,fixedCommunitiesTrust);
        if (iters.hasNext()) {
            System.out.println("The database contains subjects of type FixedCommunitiesTrust:");
            while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                FixedCommunitiesTrust fixComInstance = getFixedCommunitiesTrust(model,resource);
                System.out.println("     communityScorer:" +
                    fixComInstance.getCommunityScorer().getName());
                System.out.println("     communityScored:" +
View Full Code Here

  }
 
  public void printCategoryMatchings(Model model) throws Exception {
    Resource categoryMatching = ResourceFactory.
        createResource(riNamespace + "CategoryMatching");
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,categoryMatching);
        if (iters.hasNext()) {
            System.out.println("The database contains subjects of type categoryMatching:");
            while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                CategoryMatching catMatInstance = getCategoryMatching(model,resource);
                System.out.println(catMatInstance.toString("     "));
            }
        } else {
View Full Code Here

    return catMat;
  }
 
  public void printCategories(Model model) throws Exception {
    Resource category = ResourceFactory.createResource(riNamespace + "Category");
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,category);
        if (iters.hasNext()) {
            System.out.println("The database contains subjects of type category:");
            while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                Category categoryInstance = getCategory(model,resource);
                System.out.println(categoryInstance.toString("     "));                       
            }
        } else {
View Full Code Here

    return category;
  }
 
  public void printDimensions(Model model) throws Exception {
    Resource dimension = ResourceFactory.createResource(riNamespace + "Dimension");
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,dimension);
        if (iters.hasNext()) {
            System.out.println("The database contains subjects of type dimension:");
            while (iters.hasNext()) {
                Resource resource = iters.nextResource();
                System.out.println("  " + resource.getLocalName());
                Dimension dimensionInstance = getDimension(model,resource);
                System.out.println(dimensionInstance.toString("     "));                       
            }
        } else {
View Full Code Here

    agentResource.add(ResourceFactory.createResource(foafNamespace + "Agent"));
    agentResource.add(ResourceFactory.createResource(foafNamespace + "Person"));
    //Resource person = ResourceFactory.createResource(foafNamespace + "Person" );
   
    for(Resource agent : agentResource) {       
      ResIterator iters = model.listResourcesWithProperty(RDF.type,agent);
     
      if (iters.hasNext()) {
          System.out.println("The database contains resource Person for:");
          while (iters.hasNext()) {
            Resource resource = iters.nextResource();
            String resourceName = null;
            if(resource.getLocalName() != null) {
              resourceName = resource.getLocalName();
            } else if(resource.getId() != null) {
              if(resource.getId().getLabelString() != null) {
                resourceName = resource.getId().getLabelString();
              } else {
                resourceName = resource.getId().toString();
              }
            } else if(resource.getURI() != null) {
              resourceName = resource.getURI();
            }
            System.out.println("  " + resourceName+" class:"+resource.getClass());
            NodeIterator nodes = model.listObjectsOfProperty(resource, RDF.type);
            while(nodes.hasNext()) {
              RDFNode node = nodes.nextNode();
              if(node.isResource()) {
                System.out.println("   type " + node.asResource().getURI());
              }
            }
            StmtIterator stmtI = model.listStatements(resource, null, (RDFNode)null);
            while(stmtI.hasNext()) {
              Statement statement = stmtI.nextStatement();
              if (statement.getPredicate().toString().equals("http://xmlns.com/foaf/0.1/name")){
                userName = statement.getObject().toString();
              }
              System.out.println("   triple "+statement.getPredicate()+" - "+statement.getObject());
            }
            for(Property property : propertyAccount) {
              StmtIterator stmtI1 = model.listStatements(resource, property, (RDFNode)null);
            Entity entity = new Entity(userName);
              while(stmtI1.hasNext()) {
                Statement statement = stmtI1.nextStatement();             
                System.out.println("   OnlineAccount "+statement.getObject());
                String accountURL = "";
                String accountUserName = "";
                if(statement.getObject().isResource()) {
                  Resource onlineAccount = statement.getObject().asResource();                 
                  NodeIterator nodess = model.listObjectsOfProperty(onlineAccount, RDF.type);
                  while(nodess.hasNext()) {
                    RDFNode node = nodess.nextNode();
                    if(node.isResource()) {
                      System.out.println("      type " + node.asResource().getURI());
                    }
                  }
                  for(Property property2 : propertyAccountName) {
                    StmtIterator stmtI2 = model.listStatements(onlineAccount,
                        property2, (RDFNode)null);
                    Statement statement2 = stmtI2.nextStatement();
                    System.out.println("      AccountName "+statement2.getObject());
                    accountUserName = statement2.getObject().toString();
                  }
                  for(Property property2 : propertyAccountProfile) {
                    StmtIterator stmtI2 = model.listStatements(onlineAccount,
                        property2, (RDFNode)null);
                    if(stmtI2.hasNext()){
                      Statement statement2 = stmtI2.nextStatement();
                      System.out.println("      AccountProfile "+statement2.getObject());
                      accountURL = statement2.getObject().toString();
                    }
                  }
                  if(accountUserName.equalsIgnoreCase("not_exist")) {
                    ReputationWiki.notExistantUser.add(userName);
                    continue;
                  }
                  try{
                    Double value = Double.parseDouble(accountUserName);
                    ReputationWiki.userPredefined.add(new Ent_Eva(new Entity(userName),value));
                    continue;
                   
                  }catch (Exception e) {}
                 
                  String domain = ReputationWiki.findDomain(accountURL);
                if(domain == null) {
                  System.out.println("Error: domain is not known from user:"+
                  entity.getUniqueIdentificator()+" and it is discarted: "+ accountURL);
                  continue;
                }
                if(!accountUserName.equals("")){
                  entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
                    new EntityIdentifier(accountUserName,null));
                }
                else{
                  entity.addIdentificatorInCommunities(GlobalModel.getCommunities().get(domain),
                    new EntityIdentifier(entity.getUniqueIdentificator(),accountURL));
                }
                 
                if(!entity.getIdentificatorInCommunities().isEmpty()) {
                  GlobalModel.addEntity(entity);
                }
                }
              }
            }
          }
      }
    }   
   
    ResIterator iters = model.listSubjectsWithProperty(RDF.type,foafNamespace+"Person");
    if (iters.hasNext()) {
        System.out.println("The database contains literal person for:");
        while (iters.hasNext()) {
          Resource resource = iters.nextResource();
          System.out.println("  " + resource.getLocalName());
           // node.
           
        }
    } else {
      System.out.println("No simple String foafNamespace+Person were found in the database");
    }
   
    Property propertyOnlineAccount = ResourceFactory.createProperty(
        foafNamespace, "OnlineAccount");   
    iters = model.listSubjectsWithProperty(propertyOnlineAccount);
    if (iters.hasNext()) {
        System.out.println("The database contains OnlineAccount for:");
        while (iters.hasNext()) {
          Resource resource = iters.nextResource();
          System.out.println("  " + resource.getLocalName());
        }
    } else {
        System.out.println("No PROPERTY OnlineAccount were found in the database");
    }   
   
    iters = model.listSubjectsWithProperty(RDF.type);
    if (iters.hasNext()) {
        System.out.println("The database contains RDF.type for:");
        while (iters.hasNext()) {
          Resource resource = iters.nextResource();
          NodeIterator nodes = model.listObjectsOfProperty(resource, RDF.type);
          String resourceName = null;
          if(resource.getLocalName() != null) {
            resourceName = resource.getLocalName();
          } else if(resource.getId() != null) {
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.ResIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.