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

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

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

Refine searchRefine arrow

  • Triple
  • 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

private void output(Writer w, Node n) throws IOException 
{
  //String str = FmtUtils.stringForNode(n) ;
  String str = "?" ;
  if ( n.isLiteral() ) str = n.getLiteralLexicalForm() ;
  else if ( n.isURI() ) str = n.getURI() ;
  else if ( n.isBlank() ) str = n.getBlankNodeLabel() ;
  
  str = csvSafe(str) ;
  w.write(str) ;
}
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: epimorphics/elda

public static void addNamespace(Set<String> namespaces, Node n) {
  if (n.isURI()) 
    namespaces.add(n.getNameSpace());
  if (n.isLiteral()) {
    String uri = n.getLiteralDatatypeURI();
    if (uri != null) namespaces.add( NsUtils.getNameSpace( uri ) );
  }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

  @Override
  public boolean doCheck( Node n, EnhGraph g ) {
    return n.isURI() || n.isBlank() ;
  }
}
origin: paulhoule/infovore

int nodeType() {
  return innerNode.isURI() ? URI
      : innerNode.getLiteralDatatypeURI()!=null ? GENERAL_LITERAL
      : STRING;
}
origin: epimorphics/elda

public static Any any(RDFNode rdf) {
  Node n = rdf.asNode();
  if (n.isURI()) return uri(rdf.asResource());
  if (n.isLiteral()) return literal( n.getLiteralLexicalForm(), n.getLiteralLanguage(), n.getLiteralDatatypeURI() );
  throw new RuntimeException( "Cannot convert " + rdf + " to RDFQ.Any" );
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static String str(Node node) {
  if ( node.isLiteral() )
    return node.getLiteral().getLexicalForm() ;
  if ( node.isURI() )
    return node.getURI() ;
  // if ( node.isBlank() ) return node.getBlankNodeId().getLabelString() ;
  // if ( node.isBlank() ) return "" ;
  if ( node.isBlank() )
    NodeValue.raise(new ExprTypeException("Blank node: " + node)) ;
  NodeValue.raise(new ExprEvalException("Not a string: " + node)) ;
  return "[undef]" ;
}
origin: com.github.ansell.pellet/pellet-query

private Node getObject(Node subj, Node pred) {
  for( final Iterator<Triple> i = triples.iterator(); i.hasNext(); ) {
    Triple t = i.next();
    if( subj.equals( t.getSubject() ) && pred.equals( t.getPredicate() ) ) {
      i.remove();
      return t.getObject();
    }
  }
  return null;
}
origin: fr.lirmm.graphik/graal-io-sparql

public static Atom triple2Atom(Triple triple) {
  Node subject = triple.getSubject();
  Node object = triple.getObject();
  Node predicate = triple.getPredicate();
  if (predicate.getURI().equals(URIUtils.RDF_TYPE.toString())) {
    return DefaultAtomFactory.instance().create(node2Predicate(object, 1), node2Term(subject));
  } else {
    return DefaultAtomFactory.instance().create(node2Predicate(predicate, 2), node2Term(subject),
      node2Term(object));
  }
}
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

  @Override
  public boolean accept(Triple t) {
    if (t.getSubject().isLiteral()) return true;
    if (t.getPredicate().isBlank() || t.getPredicate().isLiteral()) return true;
    return false;
  }
} ) );
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

private static boolean isMagicProperty(PropertyFunctionRegistry registry, Triple pfTriple)
{
  if ( ! pfTriple.getPredicate().isURI() ) 
    return false ;
  if ( registry.manages(pfTriple.getPredicate().getURI()) )
    return true ;
  
  return false ;
}

origin: com.hp.hpl.jena/arq

public final String create(Node node)
{
  if ( node.isURI() )         return labelForURI(node) ;
  if ( node.isLiteral() )     return labelForLiteral(node) ;
  if ( node.isBlank() )       return labelForBlank(node) ;
  if ( node.isVariable() )    return labelForVar(node) ;
  
  // Other??
  return Long.toString(counter++) ;
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

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

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Validate a triple add to see if it should reinvoke the hook. If so
 * then the inference will be restarted at next prepare time. Incremental
 * re-processing is not yet supported but in this case would be useful.
 */
@Override
public boolean needsRerun(FBRuleInfGraph infGraph, Triple t) {
  return (t.getPredicate().getURI().startsWith(memberPrefix));
}
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: com.hp.hpl.jena/arq

protected static Expr buildFunctionCall(ItemList list)
{
  Item head = list.get(0) ;
  Node node = head.getNode() ;
  if ( node.isBlank() )
    BuilderLib.broken(head, "Blank node for function call!") ;
  if ( node.isLiteral() )
    BuilderLib.broken(head, "Literal node for function call!") ;
  ExprList args = buildExprListUntagged(list, 1) ;
  // Args
  return new E_Function(node.getURI(), args) ;
}
origin: fr.inria.eventcloud/eventcloud-api

private static MetaGraph parse(Node graph) {
  if (graph.isURI()) {
    String uri = graph.getURI();
    return parse(uri);
  }
  // return null and do not thrown an exception because this method may be
  // invoked during the deserialization of a QuadruplePattern. In such a
  // case the graph may not be an URI and the null value is useful on high
  // level to detect that no meta information has been parsed
  return null;
}
origin: org.apache.stanbol/org.apache.stanbol.entityhub.indexing.source.jenatdb

@Override
public Double doubleValue(Node node) {
  if(node.isLiteral()){
    Object value = node.getLiteral().getValue();
    if(value instanceof Double){
      return (Double)value;
    } else {
      return super.doubleValue(node);
    }
  } else {
    throw new IllegalArgumentException("parsed node is not an Literal");
  }
}
com.hp.hpl.jena.graphNode

Javadoc

A Node has five subtypes: Node_Blank, Node_Anon, Node_URI, Node_Variable, and Node_ANY. Nodes are only constructed by the node factory methods, and they will attempt to re-use existing nodes with the same label if they are recent enough.

Most used methods

  • 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]
  • isLiteral
    Answer true iff this node is a literal 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.
  • getBlankNodeLabel,
  • 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