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

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


  }

  // verbatim copy from JenaUtil
  public static String getValueAsString(RDFNode node) {
    if (node instanceof Literal) {
      Literal lit = (Literal) node;
      return lit.getLexicalForm();

    } else {
      return ((Resource) node).getURI();
    }
  }
View Full Code Here


    List<String> list = new ArrayList<String>();
    if ( dataRange != null ) {
      RDFList rdfList = dataRange.getOneOf();
      while ( rdfList != null && ! rdfList.isEmpty() ) {
        RDFNode elem = rdfList.getHead();
        Literal obj = (Literal) elem;
        String name = obj.getLexicalForm();
        list.add(name);
        rdfList = rdfList.getTail();
      }
    }
    return list;
View Full Code Here

    Set<Statement> stmts = _info.getDataTypePropertyInstantiations(instance);
    if ( stmts != null ) {
      for (Statement stmt : stmts ) {
        Property prd = stmt.getPredicate();
        Literal obj = (Literal) stmt.getObject();
       
        String prdLabel = _info.getLabel(prd);
        String objLabel = obj.getString();
       
        fields.add("{" +prdLabel+ "|" +objLabel+ "}");
      }
    }
   
View Full Code Here

     
      if ( prd.getNameSpace().equals(RDFS.getURI()) ) {
//        System.out.println(" ///////**** " +prd);

        if ( RDFS.label.equals(prd) ) {
          Literal objLit = (Literal) obj;
          _rdfsLabels.put(sbj, objLit.getLexicalForm());
          continue;
        }

        if ( RDFS.subPropertyOf.equals(prd)
        ||   RDFS.seeAlso.equals(prd)
View Full Code Here

    // add a new statement for termUri in the model:
    Resource termResource = ResourceFactory.createResource(termUri);
    Property description = ResourceFactory.createProperty(descriptionUri);
    String descriptionString = "Generated description " +System.currentTimeMillis();
    Literal descriptionObject = ResourceFactory.createPlainLiteral(descriptionString);
    Statement statement = ResourceFactory.createStatement(termResource, description, descriptionObject);
    model.add(statement);
    System.out.println("New statement: " +statement);
   
    // register a new version with this updated model:
View Full Code Here

    }
  }

  private static String _getValueAsString(RDFNode node) {
    if (node instanceof Literal) {
      Literal lit = (Literal) node;
      return lit.getLexicalForm();
    }
    else {
      return ((Resource) node).getURI();
    }
  }
View Full Code Here

       
        Resource release = model.createResource(DOAP.Version) ;
        system.addProperty(DOAP.release, release) ;
       
        Node today_node = NodeFactory.todayAsDate() ;
        Literal today = model.createTypedLiteral(today_node.getLiteralLexicalForm(), today_node.getLiteralDatatype()) ;
        release.addProperty(DOAP.created, today) ;
        release.addProperty(DOAP.name, releaseName) ;      // Again
       
        TestSuite suite = ScriptTestSuiteFactory.make(testManifest) ;
        SimpleTestRunner.runSilent(suite) ;
View Full Code Here

//        Literal now =
//            ResourceFactory.createTypedLiteral(nowStr, XSDDatatype.XSDdateTime) ;

        String todayStr = Utils.todayAsXSDDateString() ;
       
        Literal now =
            ResourceFactory.createTypedLiteral(todayStr, XSDDatatype.XSDdate) ;
           
        return earl.createResource(EARL.TestResult)
                   .addProperty(EARL.outcome, outcome)
                   .addProperty(DC.date, now) ;
View Full Code Here

        if ( n == null )
            return "<null>" ;
        if ( n instanceof Resource )
            return strForResource((Resource)n) ;
       
        Literal lit = (Literal)n ;
        return lit.getLexicalForm() ;
    }
View Full Code Here

    private void indexAnnotation(Resource skos_concept, Document conceptDoc,
            AnnotationProperty property, String field) {
        StmtIterator stmt_iter = skos_concept.listProperties(property);
        while (stmt_iter.hasNext()) {
            Literal labelLiteral = stmt_iter.nextStatement().getObject()
                    .as(Literal.class);
            String label = labelLiteral.getLexicalForm();
            String labelLang = labelLiteral.getLanguage();

            if (this.languages != null && !this.languages.contains(labelLang)) {
                continue;
            }
View Full Code Here

TOP

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

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.