Package org.wymiwyg.rdf.graphs

Examples of org.wymiwyg.rdf.graphs.NamedNode


        }
      }
      Resource assertionSource = assertion.getProperty(
          METAMODEL.asserter).getResource();
      Source source = new SourceImpl(assertionSource.getURI());
      NamedNode component = new NamedNodeImpl(assertedComponent.getURI());
      componentTypeMap.put(component, type);
      SourceComponent sourceComponent = new SourceComponent(source, component);
      {
        //adding assertion
        Literal assertionTimeLit = assertion.getProperty(
View Full Code Here


 
  /* (non-Javadoc)
   * @see com.hp.hpl.jena.gvs.storage.MoleculeStore#addContextualMolecule(org.wymiwyg.rdf.molecules.ContextualMolecule)
   */
  public NamedNode addContextualMolecule(MaximumContextualMolecule molecule) {
    NamedNode result = cMoleculesMap.get(molecule);
    if (result == null) {
      result = createNewStorageURIRef();
      cMoleculesMap.put(molecule, result);
    }
    return result;
View Full Code Here

  /* (non-Javadoc)
   * @see com.hp.hpl.jena.gvs.storage.MoleculeStore#addFunctionallyGroundedNode(org.wymiwyg.rdf.graphs.fgnodes.FunctionallyGroundedNode)
   */
  public NamedNode addFunctionallyGroundedNode(
      FunctionallyGroundedNode functionallyGroundedNode) {
    NamedNode result = fgNodesMap.get(functionallyGroundedNode);
    if (result == null) {
      result = createNewStorageURIRef();
      fgNodesMap.put(functionallyGroundedNode, result);
    }
    return result;
View Full Code Here

  /* (non-Javadoc)
   * @see com.hp.hpl.jena.gvs.storage.MoleculeStore#addTerminalMolecule(org.wymiwyg.rdf.molecules.TerminalMolecule)
   */
  public NamedNode addTerminalMolecule(TerminalMolecule molecule) {
    NamedNode result = tMoleculesMap.get(molecule);
    if (result == null) {
      result = createNewStorageURIRef();
      tMoleculesMap.put(molecule, result);
    }
    return result;
View Full Code Here

    String baseURLString = "http://"
        + serverBinding.getInetAddress().getHostName() + ":"
        + serverBinding.getPort() + "/";
    CannedDataReader.readCannedData(store, directory, baseURLString);
    Source source = new SourceImpl("http://example.org/graph-source");
    NamedNode config = new NamedNodeImpl("http://example.org/config#");
    WebServer webServer = GVSServerLauncher.launchGVSServer(store, serverBinding, null, Collections.singleton(source), config);
    URL serverURL = new URL("http://"+serverBinding.getInetAddress().getHostAddress()+":"+serverBinding.getPort()+"/application/test-dir/test-data");
    InputStream remoteStream = serverURL.openStream();
    InputStream resourceStream = ApplicationServerHandler.class.getResourceAsStream("/META-INF/web/application/test-dir/test-data.txt");
    for (int i = resourceStream.read(); i > -1; i = resourceStream.read()) {
View Full Code Here

   * (non-Javadoc)
   *
   * @see com.hp.hpl.jena.gvs.storage.MoleculeStore#addContextualMolecule(org.wymiwyg.rdf.molecules.MaximumContextualMolecule)
   */
  public NamedNode addContextualMolecule(MaximumContextualMolecule molecule) {
    NamedNode result = getNameOfContextualMolecule(molecule);
    if (result != null) {
      return result;
    }
    try {
      result = storeMolecule(molecule, METAMODEL.ContextualMolecule);
View Full Code Here

   * @return
   * @throws IOException
   */
  private NamedNode storeNTMolecule(NonTerminalMolecule molecule)
      throws IOException {
    NamedNode result;
    ComponentDirectory componentDirectory;
    synchronized (ntCurrentlyBeingAdded) {
      result = ntCurrentlyBeingAdded.get(molecule);
      if (result != null) {
        return result;
View Full Code Here

  private BidiMap<NonTerminalMolecule, NamedNode> ntCurrentlyBeingAdded = new BidiMapImpl<NonTerminalMolecule, NamedNode>();

  public NamedNode addFunctionallyGroundedNode(
      FunctionallyGroundedNode functionallyGroundedNode) {
    NamedNode result = getNameOfFunctionallyGroundedNode(functionallyGroundedNode);
    if (result != null) {
      return result;
    }
    try {
      ComponentDirectory componentDirectory;
      synchronized (currentlyBeingAdded) {
        componentDirectory = new ComponentDirectory();
        currentlyBeingAdded.put(functionallyGroundedNode,
            componentDirectory.getNode());
      }

      File directory = componentDirectory.getDirectory();
      directory.mkdirs();
      // writeMetaInf(directory, componentDirectory.getNode(),
      // METAMODEL.FunctionallyGroundedNode, functionallyGroundedNode);
      File metaInfFile = new File(directory, "meta-inf");
      Model metaInfModel = ModelFactory.createDefaultModel();
      Resource componentRes = metaInfModel
          .createResource(componentDirectory.getNode().getURIRef());
      componentRes.addProperty(RDF.type,
          METAMODEL.FunctionallyGroundedNode);
      componentRes.addProperty(METAMODEL.hashCode, metaInfModel
          .createTypedLiteral(functionallyGroundedNode.hashCode()));
      componentRes.addProperty(METAMODEL.strongHashCode, metaInfModel
          .createTypedLiteral(functionallyGroundedNode
              .strongHashCode()));
      for (NonTerminalMolecule molecule : functionallyGroundedNode
          .getGroundingMolecules()) {
        // storeNTMolecule doesn't add duplicate
        NamedNode moleculeName;
        try {
          moleculeName = storeNTMolecule(molecule);
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        componentRes.addProperty(METAMODEL.containsNonTerminalMolecule,
            metaInfModel.createResource(moleculeName.getURIRef()));
      }
      OutputStream metaInfOut = new FileOutputStream(metaInfFile);
      try {
        metaInfModel.write(metaInfOut, "N-TRIPLE");
      } finally {
View Full Code Here

   * (non-Javadoc)
   *
   * @see com.hp.hpl.jena.gvs.storage.MoleculeStore#addTerminalMolecule(org.wymiwyg.rdf.molecules.TerminalMolecule)
   */
  public NamedNode addTerminalMolecule(TerminalMolecule molecule) {
    NamedNode result = getNameOfTerminalMolecule(molecule);
    if (result != null) {
      return result;
    }
    try {
      result = storeMolecule(molecule, METAMODEL.TerminalMolecule);
View Full Code Here

   * @see com.hp.hpl.jena.gvs.storage.MoleculeStore#getNameOfFunctionallyGroundedNode(org.wymiwyg.rdf.graphs.fgnodes.FunctionallyGroundedNode)
   */
  public NamedNode getNameOfFunctionallyGroundedNode(
      FunctionallyGroundedNode functionallyGroundedNode) {
    synchronized (currentlyBeingAdded) {
      NamedNode result = currentlyBeingAdded
          .get(functionallyGroundedNode);
      if (result != null) {
        // TODO the resource may not have its properties. may be a
        // problem with concurrent access
        return result;

      }
    }
    Iterator<ComponentDirectory> hashMatchingComponents = getComponentsByHash(functionallyGroundedNode
        .hashCode());
    while (hashMatchingComponents.hasNext()) {
      ComponentDirectory componentDirectory = hashMatchingComponents
          .next();
      if (componentDirectory.getResource().hasProperty(RDF.type,
          METAMODEL.FunctionallyGroundedNode)) {
        NamedNode result = componentDirectory.getNode();
        if (functionallyGroundedNode
            .equals(getFunctionallyGroundedNode(result))) {
          return result;
        } else {
          log.debug("the hash wasn't strong enough");
View Full Code Here

TOP

Related Classes of org.wymiwyg.rdf.graphs.NamedNode

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.