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

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


        model.setNsPrefix("", BASE) ;
        Resource r1 = model.createResource(BASE+"r1") ;
        Resource r2 = model.createResource(BASE+"r2") ;
        Property p1 = model.createProperty(BASE+"p") ;
        Property p2 = model.createProperty(BASE+"p2") ;
        RDFNode v1 = model.createTypedLiteral("1", XSDDatatype.XSDinteger) ;
        RDFNode v2 = model.createTypedLiteral("2", XSDDatatype.XSDinteger) ;
       
        r1.addProperty(p1, v1).addProperty(p1, v2) ;
        r1.addProperty(p2, v1).addProperty(p2, v2) ;
        r2.addProperty(p1, v1).addProperty(p1, v2) ;
       
View Full Code Here


            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x instanceof Literal )
                {
                    Literal titleStr = (Literal)x  ;
View Full Code Here

            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x.isLiteral() )
                {
                    Literal titleStr = (Literal)x  ;
                    System.out.println("    "+titleStr) ;
                }
                else
View Full Code Here

            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x instanceof Literal )
                {
                    Literal titleStr = (Literal)x  ;
View Full Code Here

    }
   
    protected final void unwrappedReadRDF() {
        Resource subject;
        Property predicate = null;
        RDFNode object;

        while (!in.eof()) {
            while (!in.eof()) {
                inErr = false;
View Full Code Here

        ResIterator subjectIter = model.listSubjectsWithProperty(
            RDF.type, type);
        // model.write(System.out);
        while (subjectIter.hasNext()) {
          Resource infoDiscoResource = subjectIter.nextResource();
          RDFNode infoBitNode = infoDiscoResource.getProperty(
              DISCOBITS.infoBit).getObject();
          if (infoBitNode instanceof Literal) {
            final Literal literaInfoBit = (Literal) infoBitNode;
            infoDiscoBitURIs.put(infoDiscoResource.getURI(),
                new InfoBit() {
View Full Code Here

      previousTrustedSourceSize = trustedSources.size();
      Model currentModel = ModelFactory.createModelForGraph(store.getGraphOverTime(trustedSources).getGraph(new Date()));
      StmtIterator seeAlsoStmt = currentModel.listStatements(null, RDFS.seeAlso, (Resource)null);
      while(seeAlsoStmt.hasNext()) {
        Statement stmt = seeAlsoStmt.nextStatement();
        RDFNode object = stmt.getObject();
        try {
          Source seeAlsoSource = new SourceImpl(((Resource)object).getURI());
          if (trustedSources.contains(seeAlsoSource)) {
            continue;
          }
View Full Code Here

    if (type!=null && type.equals(XSD_URI+"#anySimpleType")) type = RDFS.Literal.getURI();
     
    RDFDatatype dt = getDatatype(type);
    Model m = ctx.getModel();
    Statement stmt = null;
    RDFNode object = null;
    if (value==null) return true;

    // are all restrictions observed
    if (restrictions!=null)
      for (restriction r: restrictions)
View Full Code Here

    else if (type.endsWith("#NMTOKENS")) {
      Resource r = toRDFList(elem,value,XSD.NMTOKEN.getURI(),null,ctx)
      stmt = m.createStatement(subject,prop,r);
    }
    else if (type.endsWith("#QName")) {
      RDFNode object = null;
      String name = XMLBean.expandQName(ctx.getDefaultNS(),null,value,elem,ctx.getModel());
      if (name!=null) {
        object = m.createResource(name);
        stmt = m.createStatement(subject,prop,object);
      }
    }
    else if (type.endsWith("#duration")) {
      // map duration into separate xs:yearMonthDuration and xs:dayTimeDuration
      // introduce intermediate bnode
      Resource object = m.createResource();
      stmt = m.createStatement(subject,prop,object);
      RDFNode ym = schema.yearMonthDuration(m,value);
      RDFNode dt = schema.dayTimeDuration(m,value);
      if (ym!=null) object.addProperty(RDF.value, ym);
      if (dt!=null) object.addProperty(RDF.value, dt);
    }
    else if (type.endsWith("#ENTITY")) {
      DocumentType doctype = elem.getOwnerDocument().getDoctype();
View Full Code Here

 
  public static RDFList toRDFList(Node node, String value, String itemType, RDFList list, Set<restriction> restrictions, Context ctx)
  throws Exception {
    RDFDatatype dt = getDatatype(itemType);
    Model m = ctx.getModel();
    RDFNode object = null;
   
    value = processWhitespace(node,value,itemType,ctx);

    if (itemType!=null && itemType.equals(XSD_URI+"#QName")) {
      String name = expandQName(ctx.getDefaultNS(),null,value,node,ctx.getModel());
View Full Code Here

TOP

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

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.