Codota Logo
Node.isLiteral
Code IndexAdd Codota to your IDE (free)

How to use
isLiteral
method
in
com.hp.hpl.jena.graph.Node

Best Java code snippets using com.hp.hpl.jena.graph.Node.isLiteral (Showing top 20 results out of 315)

  • Common ways to obtain Node
private void myMethod () {
Node n =
  • Codota IconTriple triple;triple.getObject()
  • Codota IconTriple triple;triple.getPredicate()
  • Codota IconTriple triple;triple.getSubject()
  • Smart code suggestions by Codota
}
origin: com.hp.hpl.jena/arq

public static boolean hasLang(Node node)
{
  if ( ! node.isLiteral() ) return false ;
  String x = node.getLiteralLanguage() ;
  if ( x == null ) return false ;
  if ( x.equals("") ) return false ;
  return true ;
}
 
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

@Override
public Resource wrapAsResource( Node n )
{
  if (n.isLiteral()) 
    throw new UnsupportedOperationException( "literal cannot be converted to Resource" );
  return this.getNodeAs( n, Resource.class );
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

protected final String stringForNode(Node n, SerializationContext context) {
  String str = FmtUtils.stringForNode(n, context);
  if (n.isLiteral() && str.contains("'")) {
    // Should escape ' to avoid a possible injection vulnerability
    str = str.replace("'", "\\'");
  }
  return str;
}
origin: apache/stanbol

@Override
public URI getLiteralType(Node n) {
  if(n.isLiteral()){
    return toLiteralTypeURI(n.getLiteralDatatypeURI());
  } else {
    throw new IllegalArgumentException("The parsed Node is not a Literal");
  }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
  Answer true iff this triple can be compared for sameValueAs by .equals(),
  ie, it is a concrete triple with a non-literal object.
*/
protected final boolean isSafeForEquality( Triple t )
  { return t.isConcrete() && !t.getObject().isLiteral(); }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

protected static boolean equalsObjectOK( Triple t )
  { 
  Node o = t.getObject();
  return o.isLiteral() ? o.getLiteralDatatype() == null : true;
  }
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

  @Override public EnhNode wrap(Node n, EnhGraph eg) {
    if (!n.isLiteral()) throw new LiteralRequiredException( n );
    return new LiteralImpl(n,eg);
  }
};          
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
  create an RDF node which might be a literal, or not.
*/
public static RDFNode createObject( Node n, EnhGraph g )
  {
  return n.isLiteral() ? (RDFNode) new LiteralImpl( n, g ) : new ResourceImpl( n, g );
  }

origin: org.apache.stanbol/org.apache.stanbol.entityhub.indexing.source.jenatdb

@Override
public String stringValue(Node node) {
  if(node.isLiteral()){
    //we do not want '"example"@en' but 'example'
    return node.getLiteralLexicalForm();
  } else {
    return node.toString();
  }
}
origin: apache/stanbol

@Override
public String stringValue(Node node) {
  if(node.isLiteral()){
    //we do not want '"example"@en' but 'example'
    return node.getLiteralLexicalForm();
  } else {
    return node.toString();
  }
}
origin: com.hp.hpl.jena/arq

protected Node stripSign(Node node)
{
  if ( ! node.isLiteral() ) return node ;
  String lex = node.getLiteralLexicalForm() ;
  String lang = node.getLiteralLanguage() ;
  RDFDatatype dt = node.getLiteralDatatype() ;
  
  if ( ! lex.startsWith("-") && ! lex.startsWith("+") )
    throw new ARQInternalErrorException("Literal does not start with a sign: "+lex) ;
  
  lex = lex.substring(1) ;
  return Node.createLiteral(lex, lang, dt) ;
}
 
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return the lexical form of a literal node, error for other node types
 */
protected String getString(Node n, RuleContext context) {
  if (n.isLiteral()) {
    return n.getLiteralLexicalForm();
  } else {
    throw new BuiltinException(this, context, getName() + " takes only literal arguments");
  }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

private String getModelName( Statement s )
  {
  Node o = s.getObject().asNode();
  return o.isLiteral() ? o.getLiteralLexicalForm(): o.getURI();
  }
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

    @Override
    public EnhNode wrap(Node n,EnhGraph eg) {
    if ( n.isURI() || n.isBlank() )
     return new ResourceImpl(n,eg);
    if ( n.isLiteral() )
     return new LiteralImpl(n,eg);
    return null;
  }
};
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static String lang(Node node) {
  if ( !node.isLiteral() )
    NodeValue.raise(new ExprTypeException("lang: Not a literal: " + FmtUtils.stringForNode(node))) ;
  String s = node.getLiteralLanguage() ;
  if ( s == null )
    s = "" ;
  return s ;
}
origin: com.hp.hpl.jena/arq

public double getDouble()
{ 
  if ( ! isNode() )
    throw new ItemException("Not a node, can't be a double: "+this) ;
  if ( ! getNode().isLiteral() )
    throw new ItemException("Not a literal, can't be a double: "+this) ;
  return ((Number)(getNode().getLiteralValue())).doubleValue() ;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public int getInt()
{ 
  if ( ! isNode() )
    throw new ItemException("Not a node, can't be an integer: "+this) ;
  if ( ! getNode().isLiteral() )
    throw new ItemException("Not a literal, can't be a integer: "+this) ;
  return ((Number)(getNode().getLiteralValue())).intValue() ;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public int getLong()
{ 
  if ( ! isNode() )
    throw new ItemException("Not a node, can't be an integer: "+this) ;
  if ( ! getNode().isLiteral() )
    throw new ItemException("Not a literal, can't be a integer: "+this) ;
  return ((Number)(getNode().getLiteralValue())).intValue() ;
}
origin: com.hp.hpl.jena/arq

public static boolean checkLiteral(Node node, ErrorHandler handler, long line, long col)
{
  if ( ! node.isLiteral() )
  {
    handler.error("Not a literal: "+node, line, col) ;
    return false ;
  }
    return checkLiteral(node.getLiteralLexicalForm(), node.getLiteralLanguage(), node.getLiteralDatatype(),  
            handler, line, col) ;
}
 
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

  @Override
  protected void check(Quad quad)
  {
    if ( Var.isVar(quad.getGraph()) || 
       Var.isVar(quad.getSubject()) || 
       Var.isVar(quad.getPredicate()) || 
       Var.isVar(quad.getObject())) 
      throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;   
    if ( quad.getSubject().isLiteral() )
      throw new QueryParseException("Literals not allowed as subjects in quad data", -1, -1) ;
  }
}
com.hp.hpl.jena.graphNodeisLiteral

Javadoc

Answer true iff this node is a literal node [subclasses override]

Popular methods of Node

  • getURI
    get the URI of this node if it has one, else die horribly
  • isURI
    Answer true iff this node is a URI node [subclasses override]
  • toString
    Answer a human-readable representation of this Node where literals are quoted according to quoting b
  • isBlank
    Answer true iff this node is a blank node [subclasses override]
  • getLiteralLexicalForm
    Answer the lexical form of this node's literal value, if it is a literal; otherwise die horribly.
  • getLiteralDatatypeURI
    Answer the data-type URI of this node's literal value, if it is a literal; otherwise die horribly.
  • createURI
    make a URI node with the specified URIref string
  • getLiteral
    Answer the literal value of a literal node, or throw an UnsupportedOperationException if it's not a
  • equals
    Nodes only equal other Nodes that have equal labels.
  • getBlankNodeLabel
    Answer the label of this blank node or throw an UnsupportedOperationException if it's not blank.
  • getLiteralLanguage
    Answer the language of this node's literal value, if it is a literal; otherwise die horribly.
  • isVariable
    Answer true iff this node is a variable node - subclasses override
  • getLiteralLanguage,
  • isVariable,
  • createLiteral,
  • getName,
  • getLiteralValue,
  • createAnon,
  • getBlankNodeId,
  • isConcrete,
  • hashCode

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now