congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
ValueFactory.createURI
Code IndexAdd Tabnine to your IDE (free)

How to use
createURI
method
in
org.eclipse.rdf4j.model.ValueFactory

Best Java code snippets using org.eclipse.rdf4j.model.ValueFactory.createURI (Showing top 17 results out of 315)

origin: streampipes/streampipes-ce

private static final URI getURI(String localPart) {
  return factory.createURI(namespace, localPart);
}
origin: org.streampipes/streampipes-measurement-units

private static final URI getURI(String localPart) {
  return factory.createURI(namespace, localPart);
}
origin: org.streampipes/streampipes-measurement-units

public List<String> getURIs(URI type) {
  if (type == null) throw new IllegalArgumentException("The type cannot be null");
  ValueFactory f = ValueFactoryImpl.getInstance();
  org.eclipse.rdf4j.model.URI uri = f.createURI(type.toString());
  
  try {
    Model statements = repos.filter(null, null, uri);
    if (statements.isEmpty())
      return Collections.emptyList();
    List<String> units = new ArrayList<>();
    for (Statement statement : statements) {
      units.add(statement.getSubject().toString());
    }
    return units; 
  } catch (Exception exception) {
    throw new IllegalStateException("Error while getting the units: " + exception.getMessage(), exception);
  }
}
origin: streampipes/streampipes-ce

public List<String> getURIs(URI type) {
  if (type == null) throw new IllegalArgumentException("The type cannot be null");
  ValueFactory f = ValueFactoryImpl.getInstance();
  org.eclipse.rdf4j.model.URI uri = f.createURI(type.toString());
  
  try {
    Model statements = repos.filter(null, null, uri);
    if (statements.isEmpty())
      return Collections.emptyList();
    List<String> units = new ArrayList<>();
    for (Statement statement : statements) {
      units.add(statement.getSubject().toString());
    }
    return units; 
  } catch (Exception exception) {
    throw new IllegalStateException("Error while getting the units: " + exception.getMessage(), exception);
  }
}
origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

  @Override
  public Value evaluate(ValueFactory valueFactory, Value... args)
    throws ValueExprEvaluationException
  {
    if (args.length < 1) {
      throw new ValueExprEvaluationException("Incorrect number of arguments");
    }
    if (!(args[0] instanceof Literal)) {
      throw new ValueExprEvaluationException("First argument must be a string");
    }
    Literal s = (Literal)args[0];
    String tmpl = s.getLabel();
    Map<String, String> mappings = new HashMap<String, String>(args.length);
    for (int i = 1; i < args.length; i++) {
      mappings.put(Integer.toString(i), args[i].stringValue());
    }
    String newValue = StrSubstitutor.replace(tmpl, mappings, "{?", "}");
    if (tmpl.charAt(0) == '<' && tmpl.charAt(tmpl.length() - 1) == '>') {
      return valueFactory.createURI(newValue.substring(1, newValue.length() - 1));
    }
    throw new ValueExprEvaluationException("Invalid URI template: " + tmpl);
  }
}
origin: streampipes/streampipes-ce

public boolean deleteContext(String contextId)
{
  try {
    RepositoryConnection conn = getConnection();
    {
      conn.clear(conn.getValueFactory().createURI(contextId));
    }
    closeConnection(conn);
    return true;
  } catch (Exception e)
  {
    e.printStackTrace();
    return false;
  }
}

origin: org.streampipes/streampipes-storage-rdf4j

public boolean deleteContext(String contextId)
{
  try {
    RepositoryConnection conn = getConnection();
    {
      conn.clear(conn.getValueFactory().createURI(contextId));
    }
    closeConnection(conn);
    return true;
  } catch (Exception e)
  {
    e.printStackTrace();
    return false;
  }
}

origin: streampipes/streampipes-ce

@Override
public boolean addIndividual(Resource resource) {
  try {
    RepositoryConnection conn = repo.getConnection();
    ValueFactory factory = conn.getValueFactory();
    String elementName = resource.getElementName().replaceAll(" ", "_");
    org.eclipse.rdf4j.model.Statement st;
    
    if (resource.getInstanceOf() != null ) st = factory.createStatement(factory.createURI(resource.getNamespace() +elementName), RDF.TYPE, factory.createURI(resource.getInstanceOf()));
    else st = factory.createStatement(factory.createURI(resource.getNamespace() +elementName), RDF.TYPE, RDFS.RESOURCE);
    
    conn.add(st);
    conn.close();
    return true;
  } catch (RepositoryException e) {
    return false;
  }
}

origin: org.streampipes/streampipes-storage-rdf4j

@Override
public boolean addIndividual(Resource resource) {
  try {
    RepositoryConnection conn = repo.getConnection();
    ValueFactory factory = conn.getValueFactory();
    String elementName = resource.getElementName().replaceAll(" ", "_");
    org.eclipse.rdf4j.model.Statement st;
    
    if (resource.getInstanceOf() != null ) st = factory.createStatement(factory.createURI(resource.getNamespace() +elementName), RDF.TYPE, factory.createURI(resource.getInstanceOf()));
    else st = factory.createStatement(factory.createURI(resource.getNamespace() +elementName), RDF.TYPE, RDFS.RESOURCE);
    
    conn.add(st);
    conn.close();
    return true;
  } catch (RepositoryException e) {
    return false;
  }
}

origin: Merck/Halyard

/**
 * Evaluate a {@link Namespace} node
 * @param node the node to evaluate
 * @param bindings the set of named value bindings
 * @return the {@link Literal} of the URI of {@link URI} returned by evaluating the argument of the {@code node}
 * @throws ValueExprEvaluationException
 * @throws QueryEvaluationException
 */
private Value evaluate(Namespace node, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException {
  Value argValue = evaluate(node.getArg(), bindings);
  if (argValue instanceof URI) {
    URI uri = (URI) argValue;
    return valueFactory.createURI(uri.getNamespace());
  } else {
    throw new ValueExprEvaluationException();
  }
}
origin: org.streampipes/streampipes-storage-rdf4j

private boolean addResource(Resource resource, org.eclipse.rdf4j.model.URI object)
{
  try {
    RepositoryConnection conn = repo.getConnection();
    ValueFactory factory = conn.getValueFactory();
    String elementName = resource.getElementName().replaceAll(" ", "_");
    org.eclipse.rdf4j.model.Statement st = factory.createStatement(factory.createURI(resource.getNamespace()
            +elementName),    RDF.TYPE, object);
    conn.add(st);
    conn.close();
    return true;
  } catch (RepositoryException e) {
    return false;
  }
}
origin: streampipes/streampipes-ce

private boolean addResource(Resource resource, org.eclipse.rdf4j.model.URI object)
{
  try {
    RepositoryConnection conn = repo.getConnection();
    ValueFactory factory = conn.getValueFactory();
    String elementName = resource.getElementName().replaceAll(" ", "_");
    org.eclipse.rdf4j.model.Statement st = factory.createStatement(factory.createURI(resource.getNamespace()
            +elementName),    RDF.TYPE, object);
    conn.add(st);
    conn.close();
    return true;
  } catch (RepositoryException e) {
    return false;
  }
}
origin: streampipes/streampipes-ce

public boolean addContext(Context context)
{
  try {
    RepositoryConnection conn = getConnection();
    {
      ValueFactory vf = conn.getValueFactory();
      RDFParser rdfParser = getParser(context.getRdfFormat());
      StatementCollector handler = new StatementCollector();
      rdfParser.setRDFHandler(handler);
      rdfParser.parse(context.getInputStream(),  context.getBaseUri());
      Collection<Statement> col = handler.getStatements();
      Iterator<Statement> it = col.iterator();
      while(it.hasNext()) {
        org.eclipse.rdf4j.model.Statement statement = it.next();
        conn.add(statement, vf.createURI(context.getContextId()));
      }
    }
    closeConnection(conn);
    return true;
  } catch (Exception e)
  {
    e.printStackTrace();
    return false;
  }
}

origin: org.streampipes/streampipes-storage-rdf4j

public boolean addContext(Context context)
{
  try {
    RepositoryConnection conn = getConnection();
    {
      ValueFactory vf = conn.getValueFactory();
      RDFParser rdfParser = getParser(context.getRdfFormat());
      StatementCollector handler = new StatementCollector();
      rdfParser.setRDFHandler(handler);
      rdfParser.parse(context.getInputStream(),  context.getBaseUri());
      Collection<Statement> col = handler.getStatements();
      Iterator<Statement> it = col.iterator();
      while(it.hasNext()) {
        org.eclipse.rdf4j.model.Statement statement = it.next();
        conn.add(statement, vf.createURI(context.getContextId()));
      }
    }
    closeConnection(conn);
    return true;
  } catch (Exception e)
  {
    e.printStackTrace();
    return false;
  }
}

origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-spin

: vf.createURI(result.toString());
origin: streampipes/streampipes-ce

org.eclipse.rdf4j.model.URI uri = f.createURI(resource.toString());
origin: org.streampipes/streampipes-measurement-units

org.eclipse.rdf4j.model.URI uri = f.createURI(resource.toString());
org.eclipse.rdf4j.modelValueFactorycreateURI

Javadoc

Creates a new URI from the supplied string-representation.

Popular methods of ValueFactory

  • createIRI
    Creates a new IRI from the supplied namespace and local name. Calling this method is funtionally equ
  • createLiteral
  • createStatement
    Creates a new statement with the supplied subject, predicate and object and associated context.
  • createBNode
    Creates a new blank node with the given node identifier.

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Permission (java.security)
    Legacy security code; do not use.
  • ImageIO (javax.imageio)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now