Examples of RdfSchema


Examples of com.google.refine.rdf.RdfSchema

    project.update();
    //Guard assertion
    assertEquals(project.rows.size(),2);
   
    //preparing the RDF schema skeleton
    RdfSchema schema = RdfSchema.reconstruct(ParsingUtilities.evaluateJsonStringToObject(json));
    project.overlayModels.put("rdfSchema", schema);
   
    //building the expected model
    expected = new SailRepository(new MemoryStore());
    expected.initialize();
View Full Code Here

Examples of com.google.refine.rdf.RdfSchema

public class AddPrefixTest {

  @Test
  public void testAddNewPrefix() throws Exception{
    RdfSchema schema = new RdfSchema();
    assertFalse(schema.getPrefixesMap().containsKey("foaf"));
    schema.addPrefix("foaf", "http://xmlns.com/foaf/0.1/");
   
    assertTrue(schema.getPrefixesMap().containsKey("foaf"));
  }
View Full Code Here

Examples of com.google.refine.rdf.RdfSchema

    ctxt.setVocabularySearcher(searcher);
  }
 
  @Test
  public void testAddPrefixCommand() throws Exception{
    RdfSchema schema = new RdfSchema();
    AddPrefixCommand command = new FakeAddPrefixCommand(ctxt,schema);
    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
   
    request.addParameter("name", name);
    request.addParameter("uri", uri);
    request.addParameter("fetch", "web");
    request.addParameter("project", projectId);
    request.addParameter("fetch-url", uri);
   
    assertFalse(schema.getPrefixesMap().containsKey("foaf"));
    assertTrue(searcher.searchClasses("foaf:P", projectId).isEmpty());
    command.doPost(request, response);
    //verification
   
    //prefix is added to the project
    assertTrue(schema.getPrefixesMap().containsKey("foaf"));
    //search
    assertFalse(searcher.searchClasses("foaf:P", projectId).isEmpty());
  }
View Full Code Here

Examples of org.deri.grefine.rdf.RdfSchema

            response.setCharacterEncoding("UTF-8");
            response.setHeader("Content-Type", "application/json");

            String jsonString = request.getParameter("schema");
            JSONObject json = ParsingUtilities.evaluateJsonStringToObject(jsonString);
            final RdfSchema schema = RdfSchema.reconstruct(json);
           
            RdfRowVisitor visitor = new RdfRowVisitor(schema) {
              final int limit = 10;
              int _count;
        @Override
        public boolean visit(Project project, int rowIndex, Row row) {
          if(_count>=limit){
                    return true;
                }
          for(Node root:roots){
            root.createNode(baseUri, factory, con, project, row, rowIndex,blanks);
          }
                _count +=1;
                return false;
        }
      };
     
            Repository model = RdfExporter.buildModel(project, engine, visitor);
            StringWriter sw = new StringWriter();
            try{
              RepositoryConnection con = model.getConnection();
              try{
                RDFWriter w = Rio.createWriter(RDFFormat.TURTLE, sw);
                for(Vocabulary v:schema.getPrefixesMap().values()){
                  w.handleNamespace(v.getName(), v.getUri());
                }
                con.export(w);
          }finally{
                con.close();
View Full Code Here

Examples of org.deri.grefine.rdf.RdfSchema

            writer.write("/ec/\n"); // end of change marker
        }
       
        static public Change load(LineNumberReader reader, Pool pool)
                throws Exception {
            RdfSchema oldSchema = null;
            RdfSchema newSchema = null;
           
            String line;
            while ((line = reader.readLine()) != null && !"/ec/".equals(line)) {
                int equal = line.indexOf('=');
                CharSequence field = line.subSequence(0, equal);
View Full Code Here

Examples of org.deri.grefine.rdf.RdfSchema

            }else{
                nodes = getRdfContext().getVocabularySearcher().searchClasses(query,projectId);
            }
           
            if(nodes.size()==0){
              RdfSchema schema = Util.getProjectSchema(getRdfContext(),getProject(request));
              nodes = search(schema,query);
            }
            for(SearchResultItem c:nodes){
                c.writeAsSearchResult(writer);
            }
View Full Code Here

Examples of org.deri.grefine.rdf.RdfSchema

        try {
            Project project = getProject(request);
           
            String jsonString = request.getParameter("schema");
            JSONObject json = ParsingUtilities.evaluateJsonStringToObject(jsonString);
            RdfSchema schema = RdfSchema.reconstruct(json);
           
            AbstractOperation op = new SaveRdfSchemaOperation(schema);
            Process process = op.createProcess(project, new Properties());
           
            performProcessAndRespond(request, response, project, process);
View Full Code Here

Examples of org.deri.grefine.rdf.RdfSchema

    return applicationContext;
  }
   
    public void export(Project project, Properties options, Engine engine,
            OutputStream outputStream) throws IOException {
      RdfSchema schema;
      try{
        schema = Util.getProjectSchema(applicationContext,project);
      }catch(VocabularyIndexException ve){
        throw new IOException("Unable to create index for RDF schema",ve);
      }
        Repository model = buildModel(project, engine, schema);
        try{
          RepositoryConnection con = model.getConnection();
          try{
            RDFWriter writer = Rio.createWriter(format, outputStream);
            for(Vocabulary v:schema.getPrefixesMap().values()){
              writer.handleNamespace(v.getName(), v.getUri());
            }
            con.export(writer);
      }finally{
            con.close();
View Full Code Here

Examples of org.deri.grefine.rdf.RdfSchema

    }

   
    public void export(Project project, Properties options, Engine engine,
            Writer writer) throws IOException {
      RdfSchema schema;
      try{
        schema = Util.getProjectSchema(applicationContext,project);
      }catch(VocabularyIndexException ve){
        throw new IOException("Unable to create index for RDF schema",ve);
      }
        Repository model = buildModel(project, engine, schema);
        try{
          RepositoryConnection con = model.getConnection();
          try{
            RDFWriter w = Rio.createWriter(format, writer);
            for(Vocabulary v:schema.getPrefixesMap().values()){
              w.handleNamespace(v.getName(),v.getUri());
            }
            con.export(w);
      }finally{
            con.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.