Package org.openrdf.model

Examples of org.openrdf.model.Graph


     * @param newuri
     * @throws AccessDeniedException
     * @throws IOException
     */
  public synchronized Thesaurus updateCodeByURI(String olduri, String newuri) throws AccessDeniedException, IOException {
    Graph myGraph = repository.getGraph();
   
    ValueFactory myFactory = myGraph.getValueFactory();
   
    URI oldobj = myFactory.createURI(olduri);
    URI newobj = myFactory.createURI(newuri);
   
    return updateElementCode(myGraph, oldobj, newobj);
View Full Code Here


     * @throws IOException
     * @throws GraphException
     */
    public void addTitleElement(String thesaurusTitle) throws IOException, AccessDeniedException, GraphException{
     
      Graph myGraph = new org.openrdf.model.impl.GraphImpl();

      ValueFactory myFactory = myGraph.getValueFactory();
     
      String namespaceSkos = "http://www.w3.org/2004/02/skos/core#";
      String namespaceDC = "http://purl.org/dc/elements/1.1/";
     
      URI mySubject = myFactory.createURI( "http://geonetwork-opensource.org/" , thesaurusTitle);
      URI skosClass = myFactory.createURI(namespaceSkos, "ConceptScheme");
      URI titleURI = myFactory.createURI(namespaceDC, "title");
     
      URI rdfType = myFactory.createURI(org.openrdf.vocabulary.RDF.TYPE);
     
      mySubject.addProperty(rdfType, skosClass);
     
      Value valueObj = myFactory.createLiteral(thesaurusTitle);
      myGraph.add(mySubject, titleURI, valueObj );
     
      repository.addGraph(myGraph);
    }
View Full Code Here

         * @param relatedSubject
         */
        public synchronized void addRelation(String subject, KeywordRelation related, String relatedSubject) throws AccessDeniedException, IOException,
        MalformedQueryException, QueryEvaluationException, GraphException {
           
            Graph myGraph = repository.getGraph();     
           
             // Set namespace skos and predicates
             ValueFactory myFactory = myGraph.getValueFactory();
             String namespaceSkos = "http://www.w3.org/2004/02/skos/core#";
             URI relationURI = myFactory .createURI(namespaceSkos, related.name);
             URI opposteRelationURI = myFactory .createURI(namespaceSkos, related.opposite().name);
             URI subjectURI = myFactory.createURI(subject);
             URI relatedSubjectURI = myFactory.createURI(relatedSubject);

             myGraph.add(subjectURI, relationURI, relatedSubjectURI);
             myGraph.add(relatedSubjectURI, opposteRelationURI, subjectURI);
        }
View Full Code Here

      if (context == null) {
        throw new RepositoryException("No configuration context for repository " + repositoryID);
      }

      Graph contextGraph = new GraphImpl();
      con.getStatements(null, null, null, true, context).addTo(contextGraph);

      return RepositoryConfig.create(contextGraph, repositoryNode);
    }
    finally {
View Full Code Here

        context = vf.createBNode();
      }

      con.add(context, RDF.TYPE, REPOSITORY_CONTEXT);

      Graph graph = new GraphImpl(vf);
      config.export(graph);
      con.add(graph, context);
    }

    con.setAutoCommit(wasAutoCommit);
View Full Code Here

      String configString = configTemplate.render(valueMap);
      // writeln(configString);

      ValueFactory vf = systemRepo.getValueFactory();

      Graph graph = new GraphImpl(vf);

      RDFParser rdfParser = Rio.createParser(RDFFormat.TURTLE, vf);
      rdfParser.setRDFHandler(new StatementCollector(graph));
      rdfParser.parse(new StringReader(configString), RepositoryConfigSchema.NAMESPACE);
View Full Code Here

  }

  public static Graph toGraph(TupleQueryResult tqr)
    throws QueryEvaluationException
  {
    Graph graph = new GraphImpl();
    DAWGTestResultSetWriter writer = new DAWGTestResultSetWriter(new StatementCollector(graph));

    try {
      writer.startQueryResult(tqr.getBindingNames());
      while (tqr.hasNext()) {
View Full Code Here

    if (!hasNewStatements()) {
      /* There's nothing to do */
      return false;
    }
   
    Graph iterationStatements = newStatements;
    newStatements = new GraphImpl();
   
    Iterator<Statement> iter = iterationStatements.iterator();
    while (iter.hasNext()) {
      Statement s = iter.next();
      if (s.getPredicate().equals(OWL.SAMEAS) && s.getObject() instanceof Resource)
        processSameAs(con, s.getSubject(), (Resource) s.getObject());
        else
View Full Code Here

      Header contentType = method.getResponseHeader("Content-Type");

      /* Interpret response for successful requests */
      if (HttpStatusCodes.isSuccess(method.getStatusCode())) {   
        RDFFormat format = guessFormat(contentType != null ? contentType.getValue() : null);
        Graph g = null;

        try {
          g = parseRdf(method, format);
        } catch (Exception e) {
          /* Couldn't parse this - try it again via the Sponger proxy. */
 
View Full Code Here

   * @throws RDFHandlerException
   * @throws RDFParseException
   */
  private Graph parseRdf(HttpMethod method, RDFFormat format) throws RDFParseException, RDFHandlerException, IOException {
    LimitedInputStream lis = new LimitedInputStream(method.getResponseBodyAsStream(), maxfilesize);
    Graph graph = new GraphImpl();
    URI urlContext = graph.getValueFactory().createURI(task.getURI().toString());
   
    addData(graph, lis, format, task.getURI().toString(), urlContext);
   
    return graph;
  }
View Full Code Here

TOP

Related Classes of org.openrdf.model.Graph

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.