congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

  • Running tasks concurrently on multiple threads
  • findViewById (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • startActivity (Activity)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • JOptionPane (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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