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

Examples of com.hp.hpl.jena.rdf.model.RDFNode.asResource()


          while(nodes.hasNext()) {
            RDFNode node = nodes.nextNode();
            if(node.isLiteral()) {
              System.out.println("   l " + node.asLiteral().getString());
            } else if(node.isResource()) {
              System.out.println("   r " + node.asResource().getURI());
            }
          }         
        }
    } else {
        System.out.println("No subject with RDF.type were found in the database");
View Full Code Here


          } else {         
            value = literal.getLexicalForm() ;
          }
        }
      } else {
        Resource objRes = object.asResource() ;
        if(object.isAnon()) {
          key = value = objRes.getId().toString() ;
        } else {
          // convert QNames to full URIs on the fly
          // problem is that if you translate the QNames,
View Full Code Here

        while (result.hasNext()) {
            QuerySolution resultBinding = result.nextSolution();
            RDFNode rdfNode = resultBinding.get("class");
            double score = resultBinding.getLiteral("score").getDouble();
            if (rdfNode.isURIResource()) {
                String uri = rdfNode.asResource().getURI();
                results.put(uri, score);
            }
        }
        for (String uri : results.keySet()) {
            double score = results.get(uri);
View Full Code Here

        while (result.hasNext()) {
            QuerySolution resultBinding = result.nextSolution();
            RDFNode rdfNode = resultBinding.get("individual");
            double score = resultBinding.getLiteral("score").getDouble();
            if (rdfNode.isURIResource()) {
                String uri = rdfNode.asResource().getURI();
                results.put(uri, score);
            }
        }
        for (String uri : results.keySet()) {
            double score = results.get(uri);
View Full Code Here

        while (result.hasNext()) {
            QuerySolution resultBinding = result.nextSolution();
            RDFNode rdfNode = resultBinding.get("cmsobject");
            double score = resultBinding.getLiteral("score").getDouble();
            if (rdfNode.isURIResource()) {
                String uri = rdfNode.asResource().getURI();
                results.put(uri, score);
            }
        }

        /*
 
View Full Code Here

    for(Property property : reputationSubclassesProperties.keySet()) {
      StmtIterator stmtI1 = model.listStatements((Resource) null, property, (RDFNode) null);
      while (stmtI1.hasNext()) {
        RDFNode object = stmtI1.nextStatement().getObject();
        if(object.isResource()) {
          resourcesCache.add(object.asResource());
        } else {
          if(!ModelException.throwException(ModelException.REPUTATIONALGORITHM,
              "Property "+property.getURI()+" has the object "
              +object+" that is not a resource when it must be a " +
              "ReputationAlgorithm instance")) {
View Full Code Here

      NodeIterator rdfTypesItr = model.listObjectsOfProperty(subjMapBlankRes, rrClassProp);
      while (rdfTypesItr.hasNext()) {
        RDFNode typeNode = rdfTypesItr.next();
       
        if (typeNode.isAnon()) {
          NodeIterator typeTemplItr = model.listObjectsOfProperty(typeNode.asResource(),
              templateProp);
         
          while (typeTemplItr.hasNext()) {
            RDFNode templNode = typeTemplItr.next();
            String template = templNode.toString();
View Full Code Here

    predicatePrefix = model.getNsURIPrefix(predicateNs);
   
    // atom argument1
    nodeIterator = model.listObjectsOfProperty(atom_resource, argument1_property);
    if (nodeIterator.hasNext() && (node = nodeIterator.next()).isResource()) {
      argument1Id = node.asResource().getLocalName();
      logger.debug("The atom argument1 is: " + argument1Id);
     
      if (isInstanceOfTheClass(node.asResource(), attribute))
        argument1Type = ArgumentType.ATTRIBUTE;
      else if (isInstanceOfTheClass(node.asResource(), variable))
View Full Code Here

    nodeIterator = model.listObjectsOfProperty(atom_resource, argument1_property);
    if (nodeIterator.hasNext() && (node = nodeIterator.next()).isResource()) {
      argument1Id = node.asResource().getLocalName();
      logger.debug("The atom argument1 is: " + argument1Id);
     
      if (isInstanceOfTheClass(node.asResource(), attribute))
        argument1Type = ArgumentType.ATTRIBUTE;
      else if (isInstanceOfTheClass(node.asResource(), variable))
        argument1Type = ArgumentType.VARIABLE;
     
    } else {
View Full Code Here

      argument1Id = node.asResource().getLocalName();
      logger.debug("The atom argument1 is: " + argument1Id);
     
      if (isInstanceOfTheClass(node.asResource(), attribute))
        argument1Type = ArgumentType.ATTRIBUTE;
      else if (isInstanceOfTheClass(node.asResource(), variable))
        argument1Type = ArgumentType.VARIABLE;
     
    } else {
      logger.info("atom does not have an argument1.");
      return null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.