Create an RdfStream from an existing Model.
@param node The subject node
@param model An input Model
@return a new RdfStream object
338272
public static RdfStream fromModel(final Node node, final Model model) {
        return new DefaultRdfStream(node,
                stream(spliteratorUnknownSize(model.listStatements(), IMMUTABLE), false).map(Statement::asTriple));
    }
206801
public NodeRepresentation createNodeRepresentation(Node node, String mediaTypeHint)
   {

      try
      {

         NodeRepresentation content =
            nodeRepresentationService.getNodeRepresentation(node.getNode("jcr:content"), mediaTypeHint);

         // return nodeRepresentationService.getNodeRepresentation(node.getNode("jcr:content"),
         // mediaTypeHint);
         return new NtFileNodeRepresentation(node, content);

      }
      catch (RepositoryException e)
      {
         LOG.error(e.getLocalizedMessage(), e);
      }
      return null;
   }
113543
public KerasModelBuilder modelJsonInputStream(InputStream modelJsonInputStream) throws IOException {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        IOUtils.copy(modelJsonInputStream, byteArrayOutputStream);
        this.modelJson = new String(byteArrayOutputStream.toByteArray());
        return this;
    }
742814
public static byte[] serialize(Node inputNode) throws Exception
	{
		// Initialize sources and targets
		ByteArrayOutputStream serializerOutput = new ByteArrayOutputStream();
		Source sourceObject = new DOMSource(inputNode); 
		Result targetObject = new StreamResult(serializerOutput);
		
		// Create XML Transformer
		TransformerFactory serializerFactory = TransformerFactory.newInstance();
		Transformer serializer = serializerFactory.newTransformer();

		// Set output properties
		serializer.setOutputProperty(OutputKeys.INDENT, "yes");
		serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
		
		// Run serialization transformation
		serializer.transform(sourceObject, targetObject);
		
		// Return output as a byte array
		return serializerOutput.toByteArray();
	}
1199848
public StaticRouting.NodesMap nodesMapFromJSON(Model mo, JSONObject o) throws JSONConverterException {
        return new StaticRouting.NodesMap(requiredNode(mo, o, "src"), requiredNode(mo, o, "dst"));
    }
393321
public static NodeWrapper newInstance(final BoltDatabaseService db, final org.neo4j.driver.v1.types.Node node) {

		synchronized (nodeCache) {

			NodeWrapper wrapper = nodeCache.get(node.id());
			if (wrapper == null || wrapper.stale) {

				wrapper = new NodeWrapper(db, node);
				nodeCache.put(node.id(), wrapper);
			}

			return wrapper;
		}
	}
1302499
public static <T> Stream<T> breadthFirst(TreeDef<T> treeDef, T node) {
		return StreamSupport.stream(TreeIterable.breadthFirst(treeDef, node).spliterator(), false);
	}
1307360
public boolean add(AbstractRslNode node) {
        if (_specifications == null) _specifications = new LinkedList();
        return _specifications.add(node);
    }
584582
public static Node createResourceFile(Node parentNode, String relPath, Object data, String mimeType)
      throws Exception
   {

      Node file = parentNode.addNode(relPath, "nt:file");
      Node contentNode = file.addNode("jcr:content", "nt:resource");

      if (data instanceof InputStream)
         contentNode.setProperty("jcr:data", (InputStream)data);
      else if (data instanceof String)
         contentNode.setProperty("jcr:data", (String)data);
      // else if(data instanceof BinaryValue)
      // contentNode.setProperty("jcr:data", (BinaryValue)data);
      else
         throw new Exception("Invalid object for jcr:data " + data);

      contentNode.setProperty("jcr:mimeType", mimeType);
      contentNode.setProperty("jcr:lastModified", Calendar.getInstance());
      return file;

   }
365723
function Node(options) {
  if (!(this instanceof Node))
    return new Node(options);

  AsyncObject.call(this);

  this.config = new Config('wmcc');
  this.config.inject(options);
  this.config.load(options);

  if (options.config)
    this.config.open('wmcc.conf');

  this.network = Network.get(this.config.network);
  this.startTime = -1;
  this.bound = [];
  this.plugins = Object.create(null);
  this.stack = [];

  this.logger = null;
  this.workers = null;

  this.spv = false;
  this.chain = null;
  this.fees = null;
  this.mempool = null;
  this.pool = null;
  this.miner = null;
  this.http = null;

  this.init();
}
334065
private ResourceXMLParser.Entity createEntity(final INodeEntry node) {
        final ResourceXMLParser.Entity ent = new ResourceXMLParser.Entity();
        ent.setName(node.getNodename());
        ent.setResourceType(NODE_ENTITY_TAG);
        

        if(null!=node.getAttributes()){
            for (final String setName : node.getAttributes().keySet()) {
                String value = node.getAttributes().get(setName);
                ent.setProperty(setName, value);
            }
        }
        if(null!=node.getTags()){
            ent.setProperty("tags", joinStrings(node.getTags(), ", "));
        }



        return ent;
    }
1290896
private static Result createResults(Command cmd, InputStream stream, ResultType type) throws SparqlException {
    XMLInputFactory xmlStreamFactory = XMLInputFactory.newInstance();
    
    // Tell the factory to combine adjacent character blocks into a single event, so we don't have to do it ourselves.
    xmlStreamFactory.setProperty(XMLInputFactory.IS_COALESCING, true);
    
    // Tell the factory to create a reader that will close the underlying stream when done.
    xmlStreamFactory.setProperty(XMLInputFactory2.P_AUTO_CLOSE_INPUT, true);
    
    XMLStreamReader rdr;
    try {
      rdr = xmlStreamFactory.createXMLStreamReader(stream, "UTF-8");
    } catch (XMLStreamException e) {
      throw new SparqlException("Unable to open XML data", e);
    }
    List<String> cols = new ArrayList<String>();
    List<String> md = new ArrayList<String>();

    try {
      if (rdr.nextTag() != START_ELEMENT || !nameIs(rdr, SPARQL)) {
        throw new SparqlException("Result is not a SPARQL XML result document");
      }
      
      // Initialize the base URI to the 
      String base = null;
      if (cmd != null) {
        base = ((ProtocolDataSource)cmd.getConnection().getDataSource()).getUrl().toString();
      }
      
      // read the header information
      parseHeader(base, rdr, cols, md);
      
      // move the cursor into the results, and read in the first row
      if (rdr.nextTag() != START_ELEMENT) throw new SparqlException("No body to result document");
      
      String typeName = rdr.getLocalName();
      if (typeName.equalsIgnoreCase(RESULTS.toString())) {
        if (type != null && type != ResultType.SELECT) {
          throw new SparqlException("Unexpected result type; expected " + type + " but found SELECT.");
        }
        return new XMLSelectResults(cmd, rdr, cols, md);
      }
      if (typeName.equalsIgnoreCase(BOOLEAN.toString())) {
        if (type != null && type != ResultType.ASK) {
          throw new SparqlException("Unexpected result type; expected " + type + " but found ASK.");
        }
        if (!cols.isEmpty()) {
          logger.warn("Boolean result contained column definitions in head: {}", cols);
        }
        return parseBooleanResult(cmd, rdr, md);
      }

      throw new SparqlException("Unknown element type in result document. Expected <results> or <boolean> but got <" + typeName + ">");
    } catch (XMLStreamException e) {
      throw new SparqlException("Error reading the XML stream", e);
    }
  }
194257
public static void writeNanopub(Nanopub nanopub, OutputStream out, RDFFormat format)
			throws RDFHandlerException {
		RDFWriter writer = Rio.createWriter(format, new OutputStreamWriter(out, Charset.forName("UTF-8")));
		writer.startRDF();
		String s = nanopub.getUri().toString();
		writer.handleNamespace("this", s);
		writer.handleNamespace("sub", s + RdfUtils.postAcChar);
		if (!(RdfUtils.bnodeChar + "").matches("[A-Za-z0-9\\-_]")) {
			writer.handleNamespace("node", s + RdfUtils.postAcChar + RdfUtils.bnodeChar);
		}
		writer.handleNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
		writer.handleNamespace("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
		writer.handleNamespace("rdfg", "http://www.w3.org/2004/03/trix/rdfg-1/");
		writer.handleNamespace("xsd", "http://www.w3.org/2001/XMLSchema#");
		writer.handleNamespace("owl", "http://www.w3.org/2002/07/owl#");
		writer.handleNamespace("dct", "http://purl.org/dc/terms/");
		writer.handleNamespace("dce", "http://purl.org/dc/elements/1.1/");
		writer.handleNamespace("pav", "http://swan.mindinformatics.org/ontologies/1.2/pav/");
		writer.handleNamespace("np", "http://www.nanopub.org/nschema#");
		for (Statement st : NanopubUtils.getStatements(nanopub)) {
			writer.handleStatement(st);
		}
		writer.endRDF();
	}
1189372
public Stream<YamlNode> loadStream(Reader yaml) {
        return StreamSupport.stream(loadAll(yaml).spliterator(), false);
    }
123593
@SuppressWarnings("unchecked")
    static <T> Node<T> emptyNode(StreamShape shape) {
        switch (shape) {
            case REFERENCE:    return (Node<T>) EMPTY_NODE;
            case INT_VALUE:    return (Node<T>) EMPTY_INT_NODE;
            case LONG_VALUE:   return (Node<T>) EMPTY_LONG_NODE;
            case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
            default:
                throw new IllegalStateException("Unknown shape " + shape);
        }
    }
1075696
private Node createNewMembershipTypeNode(Session session, MembershipTypeImpl mType) throws Exception
   {
      Node storageTypesNode = utils.getMembershipTypeStorageNode(session);
      return storageTypesNode.addNode(mType.getName());
   }
78757
public static Collection<RDFNode> getListItemsOrFail(RDFNode node) {

        if (!isList(node)) {
            throw new IllegalArgumentException("Resource not an rdf:List");
        }

        return getListItemsOrEmpty(node);
    }