Package org.openrdf.model.impl

Examples of org.openrdf.model.impl.LiteralImpl


            out.writeTriple(documentURI, csv.row, rowSubject);
            // the progressive row number
            out.writeTriple(
                    rowSubject,
                    csv.rowPosition,
                    new LiteralImpl(String.valueOf(index))
            );
            index++;
        }
        // add some CSV metadata such as the number of rows and columns
        addTableMetadataStatements(
View Full Code Here


            }
            if (!RDFUtils.isAbsoluteURI(header[index])) {
                out.writeTriple(
                        singleHeader,
                        RDFS.LABEL,
                        new LiteralImpl(header[index])
                );
            }
            out.writeTriple(
                    singleHeader,
                    csv.columnPosition,
                    new LiteralImpl(String.valueOf(index), XMLSchema.INTEGER)
            );
            index++;
        }
    }
View Full Code Here

            if (isInteger(cell)) {
                datatype = XMLSchema.INTEGER;
            } else if(isFloat(cell)) {
                datatype = XMLSchema.FLOAT;
            }
            object = new LiteralImpl(cell, datatype);
        }
        return object;
    }
View Full Code Here

            int numberOfRows,
            int numberOfColumns) {
        out.writeTriple(
                documentURI,
                csv.numberOfRows,
                new LiteralImpl(String.valueOf(numberOfRows), XMLSchema.INTEGER)
        );
        out.writeTriple(
                documentURI,
                csv.numberOfColumns,
                new LiteralImpl(String.valueOf(numberOfColumns), XMLSchema.INTEGER)
        );
    }
View Full Code Here

    }

    @Override
    public Value getNativeValue() {
        return null != this.getLanguage()
                ? new LiteralImpl(this.getLabel(), this.getLanguage())
                : null != this.getDatatype()
                ? new LiteralImpl(this.getLabel(), this.getDatatype())
                : new LiteralImpl(this.getLabel());
    }
View Full Code Here

        Resource r;
        int i = RANDOM.nextInt(TOTAL_RESOURCES) + 1;

        try {
            CloseableIteration<? extends Statement, SailException> iter
                    = sc.getStatements(null, INDEX, new LiteralImpl("" + i), false);
            try {
                r = iter.next().getSubject();
            } finally {
                iter.close();
            }
View Full Code Here

                                            } else {
                                                String type = LiteralCommons.getXSDType(ext.getValue());

                                                // we only create an in-memory representation of the value, the LMF methods
                                                // would automatically persist it, so we create a Sesame value
                                                Value value = new LiteralImpl(val.toString(),sesameService.getValueFactory().createURI(type));
                                                result.addBinding(var.substring(var.indexOf('_',1)+1,var.lastIndexOf('_')),value);
                                            }
                                        }
                                    }
                                    if(result.size() == 0) {
                                        break;
                                    } else {
                                        results.add(result);
                                    }
                                }
                                em.clear();
                                splitBindings = results.iterator();
                                return splitBindings.next();
                            } else {

                                MapBindingSet result = new MapBindingSet();
                                for(String var : mapper.getProjectedVariables()) {
                                    Long nodeId = record.getValue(var, Long.class);

                                    if(nodeId != null) {
                                        Value value = em.find(KiWiNode.class, nodeId);
                                        result.addBinding(var,value);
                                    }
                                }
                                for(Map.Entry<String,Class> ext : mapper.getExtensionVariables().entrySet()) {
                                    Object val = record.getValue(ext.getKey(),ext.getValue());

                                    // this is truly a hack: we check whether the string is a URI, and if yes create a URI resource...
                                    // it would be better to carry over this information from the value constants
                                    if(urlValidator.isValid(val.toString())) {
                                        URI value = new URIImpl(val.toString());
                                        result.addBinding(ext.getKey(),value);
                                    } else {
                                        String type = LiteralCommons.getXSDType(ext.getValue());

                                        // we only create an in-memory representation of the value, the LMF methods
                                        // would automatically persist it, so we create a Sesame value
                                        Value value = new LiteralImpl(val.toString(),sesameService.getValueFactory().createURI(type));
                                        result.addBinding(ext.getKey(),value);
                                    }
                                }

                                em.clear();
View Full Code Here

  catch(IllegalArgumentException iaex)
  {
      //System.out.println("Resource is not a URI: " + val);
      try
      {
    return new LiteralImpl(val);
      }
      catch(IllegalArgumentException iaex2)
      {
    // System.out.println("Resource is not a Literal: " + val);
    try
View Full Code Here

TOP

Related Classes of org.openrdf.model.impl.LiteralImpl

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.