Package org.wymiwyg.rdf.graphs

Examples of org.wymiwyg.rdf.graphs.Graph


    return dates[number];
  }
 
  public void write(OutputStream out) throws IOException {
    for (int i = 0; i < graphs.length; i++) {
      Graph graph = graphs[i];
      Date date = dates[i];
      try {
        out.write('\n');
        out.write(("graph nr:"+i+" asserted at").getBytes());
        out.write(date.toString().getBytes());
View Full Code Here


    FCAGraph[] graphs = new FCAGraph[size];
    Date[] dates = new Date[graphs.length];
    Date date = new Date(System.currentTimeMillis() - 1000000);
    for (int i = 0; i < graphs.length; i++) {
      // TODO at this level a graph should probably ignore ontology
      Graph currentGraph = JenaUtil.getGraphFromModel(ModelCreationUtil
          .createRandomModel(modelSize), true);
      currentGraph = MoleculeBasedLeanifier
          .getLeanVersionOf(currentGraph);
      graphs[i] = new FCAGraphImpl(currentGraph);
      dates[i] = date;
View Full Code Here

          try {
            Thread.sleep(2);
          } catch (InterruptedException e1) {
            throw new RuntimeException(e1);
          }
          Graph currentGraph = JenaUtil
              .getGraphFromModel(
                  ModelCreationUtil
                      .createRandomModel((int) (modelSize * 2 * Math
                          .random())), true);

View Full Code Here

  /* (non-Javadoc)
   * @see com.hp.hpl.jena.gvs.services.Service#start()
   */
  public void start() {
    Graph trustedGraph = store.getGraphOverTime(trustedSources).getGraph(new Date());
    Model trustedModel = JenaUtil.getModelFromGraph(trustedGraph);
    final Resource configRes = trustedModel.getResource(configuration.getURIRef());
    try {
      GVSServerLauncher.launchGVSServer(store, new ServerBinding() {
        public InetAddress getInetAddress() {
View Full Code Here

  /**
   * @param username
   * @return
   */
  private Resource getUserResource(String username) {
    Graph graph  = configGOT.getGraph(new Date());
    Model model = JenaUtil.getModelFromGraph(graph);
    ResIterator resIter = model.listSubjectsWithProperty(ACCOUNTMANAGER.userName, username);
    if (resIter.hasNext()) {
      return resIter.nextResource();
    } else {
View Full Code Here

  /**
   * @param username
   * @return
   */
  private Resource getUserResource(String username) {
    Graph graph  = configGOT.getGraph(new Date());
    Model model = JenaUtil.getModelFromGraph(graph);
    ResIterator resIter = model.listSubjectsWithProperty(ACCOUNTMANAGER.userName, username);
    if (resIter.hasNext()) {
      return resIter.nextResource();
    } else {
View Full Code Here

      if (fileURLString.endsWith(".n3") || fileURLString.endsWith(".turtle")) {
        lang = "N3";
      }
    }
    model.read(fileURLString, lang);
    Graph graph = JenaUtil.getGraphFromModel(model, true);
    Source identity = arguments.getIdentity();
    store.updateGraph(identity, new FCAGraphImpl(graph))
  }
View Full Code Here

        .hashCode());
    while (hashMatchingComponents.hasNext()) {
      ComponentDirectory componentDirectory = hashMatchingComponents
          .next();
      if (componentDirectory.getResource().hasProperty(RDF.type, type)) {
        Graph moleculeGraph = new MoleculeReader<Graph>() {

          @Override
          protected Graph asMolecule(Graph graphFromModel) {
            return deNaturalize(graphFromModel);
          }

        }.readComponent(componentDirectory);
        if (moleculeGraph == null) {
          // the molecule has not yet been finished writing, this is
          // not the one we're looking for
          continue;
        }
        if (moleculeGraph.equals(molecule)) {
          return componentDirectory.getNode();
        } else {
          log.debug("hash too weak");
        }
      }
View Full Code Here

    Iterator<ComponentDirectory> hashMatchingComponents = getComponentsByType(type);
    BidiMap<NamedNode, Graph> foundMolecules = new BidiMapImpl<NamedNode, Graph>();
    while (hashMatchingComponents.hasNext()) {
      ComponentDirectory componentDirectory = hashMatchingComponents
          .next();
      Graph moleculeGraph = new MoleculeReader<Graph>() {

        @Override
        protected Graph asMolecule(Graph graphFromModel) {
          return deNaturalize(graphFromModel);
        }
View Full Code Here

  }

  private void createMimimumFailing(int position, FCAGraph[] graphs) {
    SubGraphCreator subGraphCreator = new SubGraphCreator(graphs[position]);
    boolean lastOneFailed; // note that we are looking for failing graphs
    Graph lastFailingGraph = graphs[position];
    // int roundCount = 0;
    for (Graph currentGraph = subGraphCreator.getFirstSubgraph(); currentGraph != null; currentGraph = subGraphCreator
        .getNewSubgraph(lastOneFailed)) {
      graphs[position] = new FCAGraphImpl(currentGraph);
      lastOneFailed = !getTestResult(graphs);
      if (lastOneFailed) {
        lastFailingGraph = currentGraph;
        System.out.println("Graph " + position + " reduced to "
            + lastFailingGraph.size());
        // if (roundCount++ % 100 ==0){
        // try {
        // JenaUtil.getModelFromGraph(currentGraph).write(new
        // FileWriter("g1-"+roundCount),"N-TRIPLES");
        // } catch (IOException e) {
View Full Code Here

TOP

Related Classes of org.wymiwyg.rdf.graphs.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.