Connectivity - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Connectivity

 

New File Formats

Import and Export

New File Formats

JSON

The new JSON package allows import and export of files and strings in the JSON format, a popular format used by many modern applications for exchanging structured data.
Example: Import JSON data encoding the mailing address of Maplesoft headquarters.

currentdirFileTools:-JoinPathexample, base=datadir:

T  JSON:-ParseFileaddress.json

tableaddress=tablestreetAddress=615 Kumpf Drive,city=Waterloo,postalCode=N2V 1K8,country=Canada,province=ON,founded=1988,phoneNumbers=tabletype=local,number=+1 (519) 747-2373,tabletype=tollfree,number=+1 (800) 267-6583,tabletype=fax,number=+1 (519) 747-5284,companyName=Maplesoft

(1.1.1)

TcompanyName

Maplesoft

(1.1.2)

Taddresscity, Taddresscountry

Waterloo,Canada

(1.1.3)

Cartographic Data

The KML file format and the related KMZ compressed format are popular XML-based map data formats which are used by many mapping applications.

KML permits geographic areas and contours to be defined using line and polygon primitives.

The new Import command, described in more detail below, can import a KML map file and represent it as a 2-D plot.
In addition to KML and KMZ, Import also supports the GPX and SHP cartographical formats.

Example: Import a four-colour KMZ map of the 48 contiguous states of the United States of America.

Importhttp://www.maplesoft.com/data/examples/kmz/CONUS.kmz, title = The Contiguous United States, titlefont = Times, Bold, 20, size = 800, 400

Biological Sequence Formats

The Import and Export commands also support three popular text-based formats for representing DNA and protein sequences: FASTA, FASTQ, and GenBank.
You can import genetic or proteinomic data into your session and use text processing tools to analyze the imported sequence.

Example: Import a DNA sequence from a FASTA file.

mtDNASequenceImporthumanmtDNA.fasta:

Study the metadata for the first sequence in the file:

mtDNASequence1,1

Human mitochondrial genome,HVR2,CR,HVR1

(1.3.1)

Examine the nucleotide codes at positions 16200 through 16250:

mtDNASequence1,216200..16250

TTACAAGCAAGTACAGCAATCAACCCTCAACTATCACACATCAACTGCAAC

(1.3.2)

Count the frequency of each of nucleotide base (A, C, G, or T) in the sequence:

  frequencies  StringTools:-CharacterFrequenciesmtDNASequence1,2

A=5118,C=5185,G=2175,N=1,T=4092

(1.3.3)


Statistics:-ColumnGraph frequencies

Graph Theory Formats

The GraphTheory package now supports six new formats for import and export: DGML , Graphlet , GraphML , GXL , Pajek , and TGF.
For more information on supported graph-theoretic formats, see Formats.

GraphML Format

Pajek Format

GraphTheory:-DrawGraphImportpetersen.graphml

GraphTheory:-DrawGraphImportdraco.net,color=red

Import and Export

The new Import and Export commands provide a generic command-based mechanism to move data between Maple and the operating environment.

The Import command provides a ubiquitous mechanism for importing data with a single command.

Import is agnostic of the type of data: it can handle numeric and tabular data, images, cartographic data, specialized text file formats like XML and JSON, and special-purpose formats for graph theory and linear optimization. Several examples appear below.

 

Import 3D Models

Import Tabular Data

Import Structured Data

Import Graphs

Importdodecahedron.stl

M  Importtimedata.csv

M1..5,1..2

Company Importaddress.json:

CompanycompanyName

Maplesoft

(2.1)

Companyfounded

1988

(2.2)

CompanyaddressstreetAddress

615 Kumpf Drive

(2.3)

Companyaddresscity

Waterloo

(2.4)

Companyaddresscountry

Canada

(2.5)

Company Importcoxeter.col;

Graph 1: an undirected unweighted graph with 28 vertices and 42 edge(s)

(2.6)

GraphTheory:-DrawGraph,style=spring

 

The Export command provides an equally generic and powerful mechanism for exporting data from Maple with a single command.

 

Export Visualizations

Export to MathML

OutputFile  FileTools:-JoinPathgraphic.png, base=homedir

C:\Users\JohnSmith\graph.png

(2.7)

 

E:=seqArrayevalfseq1+sin10πi15j,i=1..15,j=1..15:

MyGraphic  dataplotE,bar,format=stacked,color=Maroon..RoyalBlue,gridlines

ExportOutputFile, MyGraphic

22685

(2.8)

OutputFile  FileTools:-JoinPathintegral.mml, base=homedir

C:\Users\JohnSmith\integral.mml

(2.9)

 

Compute an integral in Maple and export it to a MathML file.

 MyIntegral  sinx2+x ⅆx

122πcos14FresnelS2x+12πsin14FresnelC2x+12π

(2.10)

ExportOutputFile, MyIntegral

3088

(2.11)

 

Demonstrate that the export was successful by re-importing the data and retrieving the original expression.

ImportOutputFile

122πcos14FresnelS2x+12πsin14FresnelC2x+12π

(2.12)